Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SI-6488: Stop I/O threads prior to Process destruction

  • Loading branch information...
commit c7c79c83b5a7560df60ba9b4578bbce02514a22a 1 parent 34d021a
Declan Conlon authored
5 src/library/scala/sys/process/ProcessImpl.scala
View
@@ -222,7 +222,10 @@ private[process] trait ProcessImpl {
p.exitValue()
}
override def destroy() = {
- try p.destroy()
+ try{
+ outputThreads foreach (_.stop())
+ p.destroy()
+ }
finally inputThread.interrupt()
}
}
1  test/files/run/t6488.check
View
@@ -0,0 +1 @@
+Success
11 test/files/run/t6488.scala
View
@@ -0,0 +1,11 @@
+import sys.process._
+object Test {
+ // Program that prints "Success" if the command was successfully run then destroyed
+ // It will silently pass if the command "/bin/ls" does not exist
+ // It will fail due to the uncatchable exception in t6488 race condition
+ def main(args: Array[String]) {
+ try Process("/bin/ls").run(ProcessLogger { _ => () }).destroy
+ catch { case _ => () }
+ println("Success")
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.