Running Julia as a background process
In this recipe, you will learn how to run Julia as a background process, and pass commands to it using pipes.
We would like to thank Charles Duffy for ideas that helped to improve this recipe, as discussed at https://stackoverflow.com/questions/48510815/named-pipe-does-not-wait-until-completion-in-bash.
Getting ready
For this example to work, you need to run it under bash.
This would be the default under Linux. If you are on Windows, you can use the bash that is shipped with a Git installation.
Note
In the GitHub repository for this recipe, you will find the commands.txt
file, which contains the presented sequence of shell and Julia commands.
Now, open your favorite terminal to execute the commands and switch to an empty folder.
How to do it...
In this recipe, you will start a Julia process in the background and then pass commands to it via a named pipe:
- First, create a named pipe using the
mkfifo
command. We will call itpipe
:
$ mkfifo pipe
- Check that a file...