You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor Jvm methods to match specified signatures
Related to com-lihaoyi#3772
Refactor `Jvm.scala` to consolidate subprocess and classloader spawning operations into four specified signatures.
* **Refactor `callSubprocess` method:**
- Rename to `call`.
- Update parameters to match the specified `call` signature.
- Use `jvmCommandArgs` to generate command arguments.
- Call `os.call` with the updated parameters.
* **Refactor `runSubprocess` method:**
- Rename to `spawn`.
- Update parameters to match the specified `spawn` signature.
- Use `jvmCommandArgs` to generate command arguments.
- Call `os.spawn` with the updated parameters.
* **Add `spawnClassloader` method:**
- Create a new method to match the specified `spawnClassloader` signature.
- Use `mill.api.ClassLoader.create` to create a classloader.
* **Add `callClassloader` method:**
- Create a new method to match the specified `callClassloader` signature.
- Use `spawnClassloader` to create a classloader and set it as the context classloader.
- Execute the provided function with the new classloader and restore the old classloader afterward.
* **Add tests in `JvmTests.scala`:**
- Add tests for the new `call` method.
- Add tests for the new `spawn` method.
- Add tests for the new `callClassloader` method.
- Add tests for the new `spawnClassloader` method.
* Runs a JVM subprocess with the given configuration and streams
161
-
* it's stdout and stderr to the console.
162
-
* @parammainClass The main class to run
163
-
* @paramclassPath The classpath
164
-
* @paramjvmArgs Arguments given to the forked JVM
165
-
* @paramenvArgs Environment variables used when starting the forked JVM
166
-
* @paramworkingDir The working directory to be used by the forked JVM
167
-
* @parambackgroundOutputs If the subprocess should run in the background, a Tuple of ProcessOutputs containing out and err respectively. Specify None for nonbackground processes.
168
-
* @paramuseCpPassingJar When `false`, the `-cp` parameter is used to pass the classpath
169
-
* to the forked JVM.
170
-
* When `true`, a temporary empty JAR is created
171
-
* which contains a `Class-Path` manifest entry containing the actual classpath.
172
-
* This might help with long classpaths on OS'es (like Windows)
0 commit comments