Commits

perfnorm  committed de5ce59

Issue number: QUARTZ-479
Submitted by: Fabio Insaccanebbia
Save the exit code in the job execution context (for use by listeners)

git-svn-id: http://svn.opensymphony.com/svn/quartz/trunk@62869f7d36a-ea1c-0410-88ea-9fd03e4c9665

  • Participants
  • Parent commits 235cdab

Comments (0)

Files changed (1)

File src/java/org/quartz/jobs/NativeJob.java

 /*
  * <p> Built in job for executing native executables in a separate process.</p> 
  * 
+ * If PROP_WAIT_FOR_PROCESS is true, then the Integer exit value of the process
+ * will be saved as the job execution result in the JobExecutionContext.
  * 
  * @see #PROP_COMMAND
  * @see #PROP_PARAMETERS
             consumeStreams = data.getBooleanValue(PROP_CONSUME_STREAMS);
         }
             
-        this.runNativeCommand(command, parameters, wait, consumeStreams);
+        Integer exitCode = this.runNativeCommand(command, parameters, wait, consumeStreams);
+        context.setResult(exitCode);
+        
     }
 
     protected Log getLog() {
         return log;
     }
     
-    private void runNativeCommand(String command, String parameters, boolean wait, boolean consumeStreams) throws JobExecutionException {
+    private Integer runNativeCommand(String command, String parameters, boolean wait, boolean consumeStreams) throws JobExecutionException {
 
         String[] cmd = null;
         String[] args = new String[2];
+        Integer  result = null;
         args[0] = command;
         args[1] = parameters;
 
+        
         try {
             //with this variable will be done the swithcing
             String osName = System.getProperty("os.name");
             }
             
             if(wait) {
-                proc.waitFor();
+                result = Integer.valueOf(proc.waitFor());
             }
             // any error message?
             
         } catch (Exception x) {
             throw new JobExecutionException("Error launching native command: ", x, false);
         }
+        
+        return result;
     }
 
     /**