Merge pull request #8494 from calm329/fix/8442-server-subprocess-hang-linux

[2.x] fix: Prevent server subprocess hang on Linux (#8442)
This commit is contained in:
eugene yokota 2026-01-12 00:50:42 -05:00 committed by GitHub
commit 88812f27a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -390,10 +390,17 @@ class NetworkClient(
if (Util.isEmacs && !Util.isWindows) List("nohup")
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 =
new ProcessBuilder((nohup ++ cmd)*)
.directory(arguments.baseDirectory)
.redirectInput(Redirect.PIPE)
.redirectOutput(nullFile)
.redirectError(nullFile)
processBuilder.environment.put(Terminal.TERMINAL_PROPS, props)
Try(processBuilder.start()) match {
case Success(process) =>