Skip to content

Commit c5364e9

Browse files
committed
Trailing escape is error in command parser
1 parent 58fc63d commit c5364e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/src/scala/sys/process/Parser.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ private[scala] object Parser {
9494
res
9595
}
9696
def badquote() = errorFn(s"Unmatched quote [${qpos.last}](${line.charAt(qpos.last)})")
97+
def badescape() = errorFn("trailing backslash")
9798

9899
@tailrec def loop(): List[String] = {
99100
skipWhitespace()
100101
start = pos
101102
if (done) accum.reverse
102-
else if (!skipToDelim()) { badquote() ; Nil }
103+
else if (!skipToDelim()) { badquote(); Nil }
104+
else if (pos > line.length) { badescape(); Nil }
103105
else {
104106
accum ::= text()
105107
loop()

0 commit comments

Comments
 (0)