Undocumented exit code MAX_INT-1
I've noticed that when my Kubernetes pod shuts down, child processes often die with exit code 2147483646 ie MAX_INT-1, which they did not do under commons-exec. (Commons-exec would sometimes return its own INVALID_EXITVALUE in this case.) I couldn't find this code documented.
Moreover, there is a bit of a discrepancy in the docs. waitFor says it will return Integer.MIN_VALUE if the timeout is reached while NuProcessHandler.onExit returns A value of Integer.MIN_VALUE indicates some kind of launch failure. A value of Integer.MAX_VALUE indicates an unknown or expected failure mode.
It would great be to have better clarity on possible exit codes and when they should be expected.
I should say that a Java library should try to communicate exceptional conditions with exceptions (or return an object with properties), and not by overloading the exit code which the command itself might return.