Some unix command, such as tail -for starting a python web server (i.e. cherrypy), will produce infinite output, i.e. the only way to stop him is Ctrl-C. I am working on a scala application that executes this command, my implementation:
import scala.sys.process._
def exe(command: String): Unit = {
command !
}
However, since the command creates an infinite output stream, the application hangs there until I finish it or kill the process launched by the command. I am also trying to add at the end of the command to run it in the background, but my application is still freezing.
Therefore, I am looking for another way to execute a command without freezing my application.
source
share