You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But it doesn't work... It hangs and never finishes. Swapping the pump and
close lines, works, though. Like this:
$h = start \@cat, '<pipe', \*IN;
print IN "hello world\n";
close IN;
pump $h;
finish $h;
I think I understand that - cat doesn't print until STDIN has been closed
(although that doesn't jive with experiments in a normal terminal)
So then I tried this: Here I just need a single line of input. It also
doesn't work:
my$bashScript = <<'END';
echo starting - Enter a line and press enter: read LINE echo Got line: $LINE echo ending END my $h = start ['bash', '-c', $bashScript], '<pipe', \*IN; print IN "hello world\n"; pump $h; close IN; finish $h;
I don't actually understand why that doesn't work, when this does (using a
scalar and '<' instead of a glob and '<pipe'):
my$bashScript = <<'END';
echo starting - Enter a line and press enter: read LINE echo Got line: $LINE echo ending END my $in = ''; my $h = start ['bash', '-c', $bashScript], '<', \$in; $in .= "hello world\n"; pump $h; finish $h;
However this does work. I can't explain that from reading the perldoc...
my$bashScript = <<'END';
echo starting - Enter a line and press enter: read LINE echo Got line: $LINE echo ending END my $h = start ['bash', '-c', $bashScript], '<pipe', \*IN, '>', sub {print @_ }; print IN "hello world\n"; pump $h; close IN; finish $h;
Using IPC::Run version: 0.95, perl v5.20.2, debian jessie (stable).
At least the documented examples should work. So I'm asking for at least a documentation patch to fix that.
As I write, I don't understand the differences between the various scenarios above. Educating me on the details of terminal caching (e.g. why the order of pump and close matters) is perhaps not the purpose of the IPC::Run perldoc or the bug tracker, but if there is a simple explanation or, perhaps less likely, a bug somewhere I (and future perldoc readers?) wouldn't mind to understand where I went wrong.
Migrated from rt.cpan.org#121383 (status was 'new')
Requestors:
From peter@morch.com on 2017-04-26 05:11:35:
The perldoc has this example :
But it doesn't work... It hangs and never finishes. Swapping the pump and
close lines, works, though. Like this:
I think I understand that - cat doesn't print until STDIN has been closed
(although that doesn't jive with experiments in a normal terminal)
So then I tried this: Here I just need a single line of input. It also
doesn't work:
I don't actually understand why that doesn't work, when this does (using a
scalar and '<' instead of a glob and '<pipe'):
However this does work. I can't explain that from reading the perldoc...
Using IPC::Run version: 0.95, perl v5.20.2, debian jessie (stable).
--
Peter Valdemar Mørch
http://www.morch.com
The text was updated successfully, but these errors were encountered: