Files
java-core-examples/process-api/output/01-basics.txt
T

19 lines
770 B
Plaintext

== 1. the smallest thing that works
stdout = hello from a child process
exit code = 0
== 2. a failing command is NOT an exception: it is a non-zero exit code
stderr = ls: cannot access '/definitely/not/here': No such file or directory
exit code = 2
== 3. a command that does not exist IS an exception, thrown by start()
IOException: Cannot run program "no-such-binary-xyz": Exec failed, error: 2 (No such file or directory)
== 4. exitValue() before the process ends throws
IllegalThreadStateException: process hasn't exited
waitFor(200ms) returned false (false = still running, true = exited)
after destroyForcibly(): exit code = 137 (128 + SIGKILL 9 = 137 on Linux)
== 5. the shell is not involved: no pipes, no globs, no $VARS
stdout = *.txt $HOME a|b