[tcljava-user] Exec command should set errorCode (2)
Brought to you by:
mdejong
From: Michael T. A. <mt...@so...> - 2000-12-01 10:51:30
|
> Was this the patch you were going for? This > is from the CVS version. > > diff -u -r1.5 ExecCmd.java > --- ExecCmd.java 1999/05/17 03:50:37 1.5 > +++ ExecCmd.java 2000/11/30 10:19:14 > @@ -154,6 +154,9 @@ > > //when the subprocess writes to its stderr stream or returns > //a non zero result we generate an error > + if (exit != 0) { > + interp.setErrorCode(TclInteger.newInstance(exit)); > + } > if ((exit != 0) || (errorBytes != 0)) { > throw new TclException(interp, sbuf.toString()); > } Yes that is the patch I sent. Here is a better patch. The errorCode is set to a result closer to the native Tcl. //When the subprocess fails we set errorCode to the exit status. //We don't have the real process ID, so we use ??? instead. //This process id will only be usefull when background executing is implemented. //References to Process objects could be used instead of real process IDs. if (exit != 0) { interp.setErrorCode(TclString.newInstance("CHILDSTATUS ??? " + exit)); } There is no way to obtain the process ID (as far as I know). Maybe the reference to the (java) Process object could be used instead. This reference should then be returned from 'exec ... &' and the 'pid' command if implemented. Michael Tulinius Andersen Softiltiy.dk |