If we're using ->qx, we're operating synchronously anyways,
so there's little point in relying on the event loop for
waitpid.
sub qx {
my $self = shift;
my $fh = $self->popen(@_);
sub qx {
my $self = shift;
my $fh = $self->popen(@_);
- local $/ = wantarray ? "\n" : undef;
- <$fh>;
+ if (wantarray) {
+ local $/ = "\n";
+ my @ret = <$fh>;
+ close $fh; # caller should check $?
+ @ret;
+ } else {
+ local $/;
+ my $ret = <$fh>;
+ close $fh; # caller should check $?
+ $ret;
+ }
}
# check_async and cat_async may trigger the other, so ensure they're
}
# check_async and cat_async may trigger the other, so ensure they're