Skip Menu |

This queue is for tickets about the IPC-Run CPAN distribution.

Report information
The Basics
Id: 121383
Status: resolved
Priority: 0/
Queue: IPC-Run

People
Owner: Nobody in particular
Requestors: peter [...] morch.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: start \@cat, '<pipe', \*IN; doesn't work as advertised (doesn't work at all?)
Date: Wed, 26 Apr 2017 07:11:19 +0200
To: bug-IPC-Run [...] rt.cpan.org
From: Peter Valdemar Mørch <peter [...] morch.com>
Hi, The perldoc has this example : @cat = ( 'cat' ); .... $h = start \@cat, '<pipe', \*IN; print IN "hello world\n"; pump $h; close IN; finish $h; 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). -- Peter Valdemar Mørch http://www.morch.com
Ticket migrated to github as https://github.com/toddr/IPC-Run/issues/66