New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Console.readLine broken after running a Process with connectInput=true #7963
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7963?orig=1 |
legendre said: |
@som-snytt said: import scala.sys.process._
object Test extends App {
"ls".run(true).exitValue()
val line = io.StdIn.readLine("Foo bar ? ")
Console println s"[$line]"
}
Foo bar ? bye
Exception in thread "Thread-0" java.io.IOException: Stream closed
at java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:433)
at java.io.OutputStream.write(OutputStream.java:116)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.FilterOutputStream.close(FilterOutputStream.java:158)
at scala.sys.process.BasicIO$$anonfun$input$1.apply(BasicIO.scala:200)
at scala.sys.process.BasicIO$$anonfun$input$1.apply(BasicIO.scala:198)
at scala.sys.process.ProcessBuilderImpl$Simple$$anonfun$2.apply$mcV$sp(ProcessBuilderImpl.scala:73)
at scala.sys.process.ProcessImpl$Spawn$$anon$1.run(ProcessImpl.scala:23)
[]
|
legendre said (edited on Mar 6, 2015 5:05:37 PM UTC): |
I analyzed the issue in sbt/sbt#3737 (comment). We basically need a port of the fix of this old sbt issue: sbt/sbt#327. |
(Not so sure about "good first issue" and "quickfix", though ;) |
I remember thinking that upgrading to the Java 7 API could happen after |
(I do think it's a "good first issue" in the sense that it doesn't involve compiler internals or juggling a lot of competing concerns, it's a focused thing that can be tackled in isolation. There are precious few open issues in scala/bug that are actually easy and quick.) |
@SethTisue you need a label for "good GSOC issue." |
Haha, I see, everything is relative I guess. |
in 2.13, scala.sys will become its own module, at which point this could be addressed if someone cares to. closing since scala.sys issues will no longer be tracked here in scala/bug. I've made a "module:scala.sys" label so we can find relevant issues once the module has its own repo |
I'll tackle on this for OSS Hackathon@ScalaMatsuri 2019, though I'm not sure whether I can finish... |
When running this code, one needs to press enter twice in order to exit the process. This problem does not occur when using run(false) instead, so it must somehow be related to how the standard input is connected.
(still got the issue by using scala.io.ReadStdin instead of Console).
I've found a similar issue described here => http://stackoverflow.com/questions/15774987/scala-process-exits-but-doesnt-clean-up-threads/15817760#15817760
The text was updated successfully, but these errors were encountered: