"Craig A. Berry" <[EMAIL PROTECTED]> writes:
> At 1:37 PM +0100 5/31/01, [EMAIL PROTECTED] wrote:
> >I'm spawning a process from within a perl script and then doing a waitpid
> >on it and checking the return status,
> >I am looking at $? which appears to return the pid and a status in the
> >next 8 bits.
> >
> >However I really need to see the VMS exit status , the documentation
> >perlvms.pod seems to suggest that this will be contained in $^S
> >however it appears to be always blank. ( perl version 5.6.1)
>
> I see the following with both 5.6.1 and bleadperl:
>
> $ perl -e "$pid=open(F, qq/|blechh/); waitpid($pid,0); print qq/** $^S **/;"
> %DCL-W-IVVERB, unrecognized command verb - check validity and spelling
> %DCL-W-IVVERB, unrecognized command verb - check validity and spelling
> \BLECHH\
> \BLECHH\
> ** **
>
> So yes it's blank as Tony reports. With 5.5.3 I sometimes see a
> value of "0" for $^S but it usually hangs before it gets there.
> Since zero is not a valid VMS status, it doesn't look like it worked
> as documented back then either, so I'm wondering if this is something
> that just never got implemented.
Well, I guess I'm the one that last messed with my_pclose and my_waitpid.
Both return the subprocess completion status from LIB$SPAWN (not the
value returned in R0 from the call to LIB$SPAWN, but the status reported
when the subprocess runs down). No messing about, just a VMS status.
my_waitpid is called from wait4pid called from pp_waitpid, which does
a STATUS_NATIVE_SET with the VMS status, putting it in
PL_statusvalue_vms unaltered and in PL_statusvalue with the funky
"shift up by 8".
But I think the main problem is that $^S doesn't have anything like
what you want...it's some sort of "what compile/interpret mode are we
in" status. No connection to pipe/subproc completion.
$? is the beast you need. With "use vmsish (status);" it has the
true-blue VMS numeric error code.
--
Drexel University \V --Chuck Lane
======]---------->--------*------------<-------[===========
(215) 895-1545 _/ \ Particle Physics
FAX: (215) 895-5934 /\ /~~~~~~~~~~~ [EMAIL PROTECTED]