X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.support.simple%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Fexecution%2Ftasks%2FSystemCall.java;h=574e21d9e3ba195759bda74748f2a713afbae308;hb=44dd5750650b46d9979b4e06e4cc76c0b0003f4f;hp=38b0f78b4f5b759390a3d1141145c28e00a371a2;hpb=1d839531806855d37ef2c88370b64107d33dee91;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/SystemCall.java b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/SystemCall.java index 38b0f78b4..574e21d9e 100644 --- a/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/SystemCall.java +++ b/runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/execution/tasks/SystemCall.java @@ -16,9 +16,8 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.slc.SlcException; -import org.argeo.slc.execution.Executable; -public class SystemCall implements Executable { +public class SystemCall implements Runnable { // TODO: specify environment variables private final Log log = LogFactory.getLog(getClass()); @@ -37,7 +36,7 @@ public class SystemCall implements Executable { private Map> osCommands = new HashMap>(); private Map osCmds = new HashMap(); - public void execute() { + public void run() { try { if (log.isTraceEnabled()) { log.debug("os.name=" + System.getProperty("os.name")); @@ -99,7 +98,7 @@ public class SystemCall implements Executable { }; stdOutThread.start(); StreamReaderThread stdErrThread = new StreamReaderThread(process - .getInputStream()) { + .getErrorStream()) { protected void callback(String line) { stdErrCallback(line); } @@ -111,8 +110,10 @@ public class SystemCall implements Executable { // Wait for the end of the process if (synchronous) { Integer exitCode = process.waitFor(); - if (exitCode != 0) + if (exitCode != 0) { + Thread.sleep(5000);// leave the process a chance to log log.warn("Process return exit code " + exitCode); + } } else { // asynchronous: return } @@ -132,7 +133,7 @@ public class SystemCall implements Executable { else return dir.getPath(); } - + protected void stdOutCallback(String line) { log(stdOutLogLevel, line); }