Dan Sugalski <[EMAIL PROTECTED]> writes:
> At 07:49 AM 3/3/00 -0500, [EMAIL PROTECTED] wrote:
>>To summarize:
>> EOFs come at subprocess exit, so Perl isn't producing them
>> EOFs occur whether SYS$OUTPUT is explicitly defined in LIB$SPAWN,
>> defaulted in LIB$SPAWN (old pipe scheme),
>> or by DEFINE in command procedure (new scheme)
>> doing "open sys$output" doesn't seem to work...
>>
>>So, there's three choices:
>> 1. live with spurious EOFs from subprocesses of subprocesses(ugh++)
>> 2. set SYS$OUTPUT to NL: if not piping out of subprocess (ugh)
>> 3. try to filter the EOFs (ugh)
>
> Are the EOFs causing problems for any of the subprocesses or just perl? If
> it's just perl, I'd say let's live with it for a bit and at some point
> throw in a bit of code that double-checks to see if the child process has
> actually gone away or not.
We already have code that checks whether child processes have terminated.
That's not the problem.
The EOFs are coming from child-of-a-child subprocesses; there's no way
for the parent (grandparent?) to check up on them.
Here's a set of programs to demonstrate....execute test_1.pl to run
the test.
------------------test_1.pl--------------------------------
#! perl
print "this is test_1\n";
open(T2,"perl test_2.pl|") || die('error opening test_2');
$SIG{ALRM} = sub { print "***TIMEOUT***"; exit 1;} ;
while(1) {
while (<T2>) {
alarm(0);
print "test_1 read: $_";
}
print "test_1 read: --EOF--\n";
alarm(5);
}
------------------test_2.pl--------------------------------
#! perl
print "this is test_2\n";
open(T3,"|perl test_3.pl") || die('test_2 error opening test_3');
for ($j = 0; $j < 5; $j++) {
sleep(1);
print "test_2 writing 'hey $j' to test_3\n";
print T3 "hey $j\n";
}
print "test_2, closing test_3 i/o\n";
close T3;
sleep(1);
print "test_2, closed i/o to test_3, now exiting\n";
------------------test_3.pl--------------------------------
#! perl
print "this is test_3\n";
for ($j = 0; $j < 5; $j++) {
$x = <STDIN>;
chomp($x);
print "test_3 read: $x\n";
}
print "test_3, deciding to exit\n";