mirror of https://github.com/sbt/sbt.git
fix: Prevent server subprocess hang on Linux (#8442)
This commit is contained in:
parent
e7323171a2
commit
476730aba2
|
|
@ -390,10 +390,17 @@ class NetworkClient(
|
||||||
if (Util.isEmacs && !Util.isWindows) List("nohup")
|
if (Util.isEmacs && !Util.isWindows) List("nohup")
|
||||||
else Nil
|
else Nil
|
||||||
|
|
||||||
|
// https://github.com/sbt/sbt/issues/8442
|
||||||
|
// On Linux, if stdout/stderr are inherited and the buffer fills up (~64KB),
|
||||||
|
// the server process will block on writes. Discard output since the server
|
||||||
|
// communicates via the boot socket, not stdout/stderr.
|
||||||
|
val nullFile = new File(if (Util.isWindows) "NUL" else "/dev/null")
|
||||||
val processBuilder =
|
val processBuilder =
|
||||||
new ProcessBuilder((nohup ++ cmd)*)
|
new ProcessBuilder((nohup ++ cmd)*)
|
||||||
.directory(arguments.baseDirectory)
|
.directory(arguments.baseDirectory)
|
||||||
.redirectInput(Redirect.PIPE)
|
.redirectInput(Redirect.PIPE)
|
||||||
|
.redirectOutput(nullFile)
|
||||||
|
.redirectError(nullFile)
|
||||||
processBuilder.environment.put(Terminal.TERMINAL_PROPS, props)
|
processBuilder.environment.put(Terminal.TERMINAL_PROPS, props)
|
||||||
Try(processBuilder.start()) match {
|
Try(processBuilder.start()) match {
|
||||||
case Success(process) =>
|
case Success(process) =>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue