Skip to content

Commit 2fffa58

Browse files
committed
.
1 parent 0c1f1a1 commit 2fffa58

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

os/src/ProcessOps.scala

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ object call {
5555
timeout: Long,
5656
check: Boolean,
5757
propagateEnv: Boolean,
58-
timeoutGracePeriod: Long,
58+
timeoutGracePeriod: Long
5959
): CommandResult = {
6060
call(
6161
cmd = cmd,
@@ -248,17 +248,17 @@ case class proc(command: Shellable*) {
248248
)
249249

250250
private[os] def call(
251-
cwd: Path,
252-
env: Map[String, String],
253-
stdin: ProcessInput,
254-
stdout: ProcessOutput,
255-
stderr: ProcessOutput,
256-
mergeErrIntoOut: Boolean,
257-
timeout: Long,
258-
check: Boolean,
259-
propagateEnv: Boolean,
260-
timeoutGracePeriod: Long
261-
): CommandResult = call(
251+
cwd: Path,
252+
env: Map[String, String],
253+
stdin: ProcessInput,
254+
stdout: ProcessOutput,
255+
stderr: ProcessOutput,
256+
mergeErrIntoOut: Boolean,
257+
timeout: Long,
258+
check: Boolean,
259+
propagateEnv: Boolean,
260+
timeoutGracePeriod: Long
261+
): CommandResult = call(
262262
cwd,
263263
env,
264264
stdin,
@@ -272,7 +272,6 @@ case class proc(command: Shellable*) {
272272
shutdownHook = false
273273
)
274274

275-
276275
/**
277276
* The most flexible of the [[os.proc]] calls, `os.proc.spawn` simply configures
278277
* and starts a subprocess, and returns it as a `java.lang.Process` for you to
@@ -323,7 +322,7 @@ case class proc(command: Shellable*) {
323322
lazy val shutdownHookMonitorThread = shutdownHookThread.map(t =>
324323
new Thread("subprocess-shutdown-hook-monitor") {
325324
override def run(): Unit = {
326-
while(proc.wrapped.isAlive) Thread.sleep(1)
325+
while (proc.wrapped.isAlive) Thread.sleep(1)
327326
Runtime.getRuntime().removeShutdownHook(t)
328327
}
329328
}
@@ -349,19 +348,25 @@ case class proc(command: Shellable*) {
349348
}
350349

351350
def spawn(
352-
cwd: Path,
353-
env: Map[String, String],
354-
stdin: ProcessInput,
355-
stdout: ProcessOutput,
356-
stderr: ProcessOutput,
357-
mergeErrIntoOut: Boolean,
358-
propagateEnv: Boolean
359-
): SubProcess = spawn(
360-
cwd = cwd, env = env, stdin = stdin, stdout = stdout, stderr = stderr,
351+
cwd: Path,
352+
env: Map[String, String],
353+
stdin: ProcessInput,
354+
stdout: ProcessOutput,
355+
stderr: ProcessOutput,
356+
mergeErrIntoOut: Boolean,
357+
propagateEnv: Boolean
358+
): SubProcess = spawn(
359+
cwd = cwd,
360+
env = env,
361+
stdin = stdin,
362+
stdout = stdout,
363+
stderr = stderr,
361364
mergeErrIntoOut = mergeErrIntoOut,
362365
propagateEnv = propagateEnv,
363-
shutdownGracePeriod = 100, shutdownHook = false
366+
shutdownGracePeriod = 100,
367+
shutdownHook = false
364368
)
369+
365370
/**
366371
* Pipes the output of this process into the input of the [[next]] process. Returns a
367372
* [[ProcGroup]] containing both processes, which you can then either execute or

os/src/SubProcess.scala

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,17 @@ class SubProcess(
111111
val shutdownHookMonitorThread: Option[Thread]
112112
) extends ProcessLike {
113113
def this(
114-
wrapped: java.lang.Process,
115-
inputPumperThread: Option[Thread],
116-
outputPumperThread: Option[Thread],
117-
errorPumperThread: Option[Thread]) = this(
118-
wrapped, inputPumperThread, outputPumperThread, errorPumperThread, 100, None
114+
wrapped: java.lang.Process,
115+
inputPumperThread: Option[Thread],
116+
outputPumperThread: Option[Thread],
117+
errorPumperThread: Option[Thread]
118+
) = this(
119+
wrapped,
120+
inputPumperThread,
121+
outputPumperThread,
122+
errorPumperThread,
123+
100,
124+
None
119125
)
120126
val stdin: SubProcess.InputStream = new SubProcess.InputStream(wrapped.getOutputStream)
121127
val stdout: SubProcess.OutputStream = new SubProcess.OutputStream(wrapped.getInputStream)
@@ -145,7 +151,7 @@ class SubProcess(
145151
def destroyForcibly(shutdownGracePeriod: Long = this.shutdownGracePeriod): Unit = {
146152
val now = System.currentTimeMillis()
147153

148-
while(wrapped.isAlive && System.currentTimeMillis() - now < shutdownGracePeriod){
154+
while (wrapped.isAlive && System.currentTimeMillis() - now < shutdownGracePeriod) {
149155
Thread.sleep(1)
150156
}
151157

0 commit comments

Comments
 (0)