//synchronized(monitor){
try {
process = Command.createProcess(command,true);
CommandResult result = Command.execute(process);
String rst = result.getOutput();
finished = true;
if(!aborted) {
if(outputfile==null && variable==null) pc.write(rst);
else {
if(outputfile!=null) IOUtil.write(outputfile, rst, SystemUtil.getCharset(), false);
if(variable!=null) pc.setVariable(variable,rst);
}
if(errorFile != null) IOUtil.write(errorFile, result.getError(), SystemUtil.getCharset(), false);
if(errorVariable != null) pc.setVariable(errorVariable, result.getError());
}
}
catch(Exception ioe){
exception=ioe;
}