summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/StringContext.scala2
-rw-r--r--src/library/scala/sys/process/ProcessImpl.scala5
-rw-r--r--test/files/run/t6488.check1
-rw-r--r--test/files/run/t6488.scala11
-rw-r--r--test/files/run/t6559.scala17
5 files changed, 34 insertions, 2 deletions
diff --git a/src/library/scala/StringContext.scala b/src/library/scala/StringContext.scala
index fb43d56020..4078168bb3 100644
--- a/src/library/scala/StringContext.scala
+++ b/src/library/scala/StringContext.scala
@@ -120,7 +120,7 @@ case class StringContext(parts: String*) {
val bldr = new java.lang.StringBuilder(process(pi.next()))
while (ai.hasNext) {
bldr append ai.next
- bldr append treatEscapes(pi.next())
+ bldr append process(pi.next())
}
bldr.toString
}
diff --git a/src/library/scala/sys/process/ProcessImpl.scala b/src/library/scala/sys/process/ProcessImpl.scala
index cdf7d72caa..84ef5f277b 100644
--- a/src/library/scala/sys/process/ProcessImpl.scala
+++ b/src/library/scala/sys/process/ProcessImpl.scala
@@ -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()
}
}
diff --git a/test/files/run/t6488.check b/test/files/run/t6488.check
new file mode 100644
index 0000000000..35821117c8
--- /dev/null
+++ b/test/files/run/t6488.check
@@ -0,0 +1 @@
+Success
diff --git a/test/files/run/t6488.scala b/test/files/run/t6488.scala
new file mode 100644
index 0000000000..487614ecfd
--- /dev/null
+++ b/test/files/run/t6488.scala
@@ -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")
+ }
+}
diff --git a/test/files/run/t6559.scala b/test/files/run/t6559.scala
new file mode 100644
index 0000000000..5c671f7275
--- /dev/null
+++ b/test/files/run/t6559.scala
@@ -0,0 +1,17 @@
+
+object Test {
+
+ def main(args: Array[String]) = {
+ val one = "1"
+ val two = "2"
+
+ val raw = raw"\n$one\n$two\n"
+ val escaped = s"\n$one\n$two\n"
+ val buggy = "\\n1\n2\n"
+ val correct = "\\n1\\n2\\n"
+
+ assert(raw != escaped, "Raw strings should not be escaped.")
+ assert(raw != buggy, "Raw strings after variables should not be escaped.")
+ assert(raw == correct, "Raw strings should stay raw.")
+ }
+}