That's a bug, allright.
Looks to me like it's my_pclose() in VMS.C gets hung up trying to write an EOF
to the pipe. I haven't really debugged it, but I have some inductive reasons to
believe this.
When try Robert's test the subprocess created by the pipe open is dead, but it
appears that there's a write active on a MBA device (noted with ANAL/SYS). You
can read that mailbox (just a COPY MBANNNN: TT:) and the process completes. I
see that there's an WRITE EOF in my_pclose() that does a SYS$QIOW (wait) with no
timeout or anything.
I don't know why an ERROR exit status like 44 would be different than a success
status here. The error exit must force closing of SYS$INPUT or something which
causes the process to die before the EOF can be written (just a wild guess).
If I get a chance this weekend, I'll look into this in more detail. A
workaround would just to make that EOF write a SYS$QIO and enforce a timeout.
Any number of cleaner fixes could be imagined. I would bet that a SYS$GETDVI()
could be done on the MBA device being written to to determine the owner and if
the owner is gone (Owner = "", which it is in this case) just forgo the writing
of the EOF.
It could easily be the case that I won't get a chance to look at it this
weekend, but I thought someone might want to hear my speculations anyway.
Robert,
You probably want a workaround that doesn't involve debugging and rebuilding
Perl...
I can't come up with anything other than creating a temporary file for your
commands. Anybody have other ideas?
> -----Original Message-----
> From: Robert Sundstrom [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 18, 2000 11:59 AM
> To: [EMAIL PROTECTED]
> Subject: Executing DCL-commands from Perl programs
>
>
> Hello all.
> I have been trying to integrate DCL-scripts with
> Perl-programs. It works
> fine when one is using temporary files to build the sequence of
> DCL-commands you want. On the VMS Perl FAQ I learned about a method to
> execute several DCL-commands in a row without using temporary files.
>
> Unfortunately, it does not work well if you have a DCL-script
> that ends
> with exit 44, that is forcing an abort. The Perl program never resumes
> execution after the print statement. Something probably
> aborts (just as it
> is supposed to... :-), and control is never returned to Perl.
>
> I don't have enough VMS-diplomas to determine if this is a feature, a
> misfeature or a bug. I simply either want my Perl script to
> abort as well,
> or to be able to detect the EXIT parameter of the DCL-script
> in my Perl
> program. Does anyone have any advice on this matter?
>
> This is my source code:
>
> A.COM
>
> $ EXIT 44
>
> A.PL
>
> open(CMD,"|\@sys\$input");
> print CMD "\@a.com\n";
> close(CMD);
> exit;
>
> A little transcript of my output:
>
> ROBERT>type a.com
> $ exit 44
>
> ROBERT>perl a.pl
> %SYSTEM-F-ABORT, abort
> Interrupt
>
> ROBERT>stop
>