I use Processthrough ProcessBuilderto run an executable file made in C code. I catch Process.exitValue()to respond to these output values. I noticed that not all output values from the executable file. For example, I get an output value of 139 and nowhere in my C code do I return an output value of 139.
I am trying to find an overview of the output values, but I cannot find this, and now I have found that the output value may be OS dependent. (By the way, I'm using Ubuntu).
It seems the only output value that needs to be sure is 0 when everything goes right. Are there specifications for output values? Can I be sure that a certain range can only be used for my own program? What exit codes are reserved for the OS.
I found out that 139 is probably a memory error in C code. I want to get rid of the possible. I cannot get an overview of output values (e.g. 139 = .....)
This is simplified code, by the way:
ProcessBuilder p = new ProcessBuilder(executableName,
executableArguments);
final Process shell = p.start();
InputStream shellIn = shell.getInputStream();
int shellExitStatus = shell.exitValue();
Note. Running the C executable in the Ubuntu shell does not give any error (i.e. the output value is 0). But executing the same command in Java gives an output value of 139.
source
share