IPC::Open3 and determining if child is waiting for input
问题 sub run_command { my $COMMAND = shift; my @OUTPUT; my %CMD = {}; $CMD{pid} = open3(my $CH_IN, my $CH_OUT, my $CH_ERR, $COMMAND); $CMD{_STDIN} = $CH_IN; $CMD{_STDOUT} = $CH_OUT; $CMD{_STDERR} = $CH_ERR; my $line = readline $CMD{_STDOUT}; print $line; # open my $CMDPROC, q{-|}, $COMMAND or return; # foreach (<$CMDPROC>) # { # push @OUTPUT, "$ARG"; # } close $CMDPROC or return; return @OUTPUT } The above code is part of a script I am writing which needs to run another script (called child). The