Checking my copy of Stevens APUE my reading (and vague recollections of actual behavior) confirms this; you're not going to get SIGPIPE until you actually write to the fd the child's closed. The SIGCHLD should be the first sign you get.
use IPC::Run qw( start pump );
use Log::Log4perl qw( :easy );
Log::Log4perl->easy_init($DEBUG);
$SIG{$_} = eval qq{sub{INFO qq{Got $_}; 1}} for qw(CHLD PIPE);
INFO q{Starting};
my $in=q{};
my $chld = start(["bash","-c","sleep 5"],q{<},\$in);
## This will get CLHD and sleep will exit early
INFO q{Sleeping};
my $r=sleep(10);
WARN( qq{$r, $!} );
## This will trigger PIPE
$in .= qq{FOO};
pump $chld;
## This won't be reached.
INFO q{Done}
__END__
2021/01/13 15:07:42 Starting
2021/01/13 15:07:42 Sleeping
2021/01/13 15:07:47 Got CHLD
2021/01/13 15:07:47 5, Interrupted system call
2021/01/13 15:07:47 Got PIPE
ack Broken pipe: write( 6, 'FOO' ) at ....
The cake is a lie.
The cake is a lie.
The cake is a lie.
|