File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
build/src/main/scala/scala/build
integration/src/test/scala/scala/cli/integration Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -233,11 +233,12 @@ object Inputs {
233
233
lazy val dir = path / os.up
234
234
lazy val subPath = path.subRelativeTo(dir)
235
235
lazy val stdinOpt0 = stdinOpt
236
- val isStdin = (arg == " -" || arg == " - .scala" || arg == " _" || arg == " _.scala" ) &&
236
+ val isStdin = (arg == " -.scala" || arg == " _" || arg == " _.scala" ) &&
237
237
stdinOpt0.nonEmpty
238
238
if (isStdin) Right (Seq (VirtualScalaFile (stdinOpt0.get, " <stdin>" )))
239
- else if ((arg == " -.sc" || arg == " _.sc" ) && stdinOpt0.nonEmpty)
240
- Right (Seq (VirtualScript (stdinOpt0.get, " <stdin>" , os.sub / " stdin.sc" )))
239
+ else if ((arg == " -" || arg == " -.sc" || arg == " _.sc" ) && stdinOpt0.nonEmpty) {
240
+ Right (Seq (VirtualScript (stdinOpt0.get, " stdin" , os.sub / " stdin.sc" )))
241
+ }
241
242
else if (arg.contains(" ://" )) {
242
243
val url =
243
244
if (githubGistsArchiveRegex.findFirstMatchIn(arg).nonEmpty) s " $arg/download " else arg
Original file line number Diff line number Diff line change @@ -611,10 +611,21 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
611
611
}
612
612
}
613
613
614
- if (! Properties .isWin)
614
+ if (! Properties .isWin) {
615
615
test(" piping" ) {
616
616
piping()
617
617
}
618
+ test(" Scripts accepted as piped input" ) {
619
+ val message = " Hello"
620
+ val input = s " println( \" $message\" ) "
621
+ emptyInputs.fromRoot { root =>
622
+ val output = os.proc(TestUtil .cli, " -" , extraOptions)
623
+ .call(cwd = root, stdin = input)
624
+ .out.text.trim
625
+ expect(output == message)
626
+ }
627
+ }
628
+ }
618
629
619
630
def fd (): Unit = {
620
631
emptyInputs.fromRoot { root =>
You can’t perform that action at this time.
0 commit comments