How do I find whether a Julia script running in the terminal has the output (stdout) redirected to the screen or a pipe?
$ ./julia_script # outputs to the terminal
$ ./julia_script | command # pipes the output
How do I find whether a Julia script running in the terminal has the output (stdout) redirected to the screen or a pipe?
$ ./julia_script # outputs to the terminal
$ ./julia_script | command # pipes the output
The type of stdout
should help you determine that:
$ julia -e 'println(typeof(stdout))'
Base.TTY
$ julia -e 'println(typeof(stdout))' | cat
Base.PipeEndpoint
Wow. Excellent!
Thank you!