jobDetails.setJobDescription(app.toString());
GFacUtils.saveJobStatus(jobExecutionContext,jobDetails, JobState.SETUP);
// running cmd
Process process = builder.start();
Thread standardOutWriter = new InputStreamToFileWriter(process.getInputStream(), app.getStandardOutput());
Thread standardErrorWriter = new InputStreamToFileWriter(process.getErrorStream(), app.getStandardError());
// start output threads
standardOutWriter.setDaemon(true);
standardErrorWriter.setDaemon(true);
standardOutWriter.start();
standardErrorWriter.start();
int returnValue = process.waitFor();
// make sure other two threads are done
standardOutWriter.join();
standardErrorWriter.join();
/*
* check return value. usually not very helpful to draw conclusions based on return values so don't bother.
* just provide warning in the log messages
*/