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());
private Map<String, List<String>> osCommands = new HashMap<String, List<String>>();
private Map<String, String> osCmds = new HashMap<String, String>();
- public void execute() {
+ public void run() {
try {
if (log.isTraceEnabled()) {
log.debug("os.name=" + System.getProperty("os.name"));
};
stdOutThread.start();
StreamReaderThread stdErrThread = new StreamReaderThread(process
- .getInputStream()) {
+ .getErrorStream()) {
protected void callback(String line) {
stdErrCallback(line);
}
// 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
}
else
return dir.getPath();
}
-
+
protected void stdOutCallback(String line) {
log(stdOutLogLevel, line);
}