apex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Benninger <cbennin...@phemi.com>
Subject Running shell commands which fork from within Operator exits with 143 exit code
Date Thu, 09 Feb 2017 19:02:42 GMT

I have a little bit of a weird use-case but I'm running a script from
within an operator which forks a sub process using & (I know I know). Im
porting this from spark as a PoC and in Apex It seems to be sending the
parent shell process a SIGTERM resulting in a 143. When I remove the fork
(altering the output) it all works fine however.

my code:

String cmd = "bash myscript.sh"

Process p = Runtime.getRuntime().exec(cmd, null, workingDir.toFile());

BufferedReader stdoutReader = new BufferedReader(new
String line;
while ((line = stdoutReader.readLine()) != null) {

BufferedReader stderrReader = new BufferedReader( new
while ((line = stderrReader.readLine()) != null) {

int retValue = p.exitValue();
System.out.println("Exit code: "+retValue);

Any help appreciated.

View raw message