user2305158
user2305158

Reputation: 1

Wrong exit value from external program

I'm trying to read exit value from external program but it's always 0.

String command = ("cmd  /c start /wait "+ Script[0]);                          
Process exec = runtime.exec(command);                   
int waitFor = exec.waitFor();
System.out.println(exec.exitValue);     //always 0   
System.out.println(waitFor); //always 0     

Program is used for programming modules and I need to know if there were any error's.

How to get the application exit value?

Upvotes: 0

Views: 485

Answers (1)

Shaun
Shaun

Reputation: 2476

The program you're actually running is the cmd program, not whatever you're running under that.

See How do I get the application exit code from a Windows command line? for how to extract the underlying exit code.

Upvotes: 1

Related Questions