Stream from command output never completes

val out = (“cat” #< new File("/etc/passwd")).lineStream_!
println(“after command”,out)
out.foreach(println)
println(“after print”)

The above code will print the contents of the file but then appears to hang. The after print is never executed. One thought is that the command output stream is not closed but in this case the “cat” command is pretty simple and should close its output.

How can I get this stream to terminate?

works for me: https://scastie.scala-lang.org/x3bJT6g6RSqJTS1otPGUqA

I am running under Akka. Not sure if that makes a difference. This works on my windows box when added to a simple “hello world” example. However, when I run in Ubuntu with akka it hangs. If I run using the form “command”.!! it works in the akka example but when I use redirection it seems to hang.

Looks like I am able to solve it by using ProcessIO with run. I have no clue why but it seems to work.