use strict; use warnings; use Sys::Cmd 'spawn'; my $proc = spawn( 'file-not-found' } ); $proc->stdin->print("x\n"); $proc->wait_child; #### main::(j:5): my $proc = spawn( sub { print "hello\n" } ); DB<1> n main::(j:6): warn ref $proc->stdin; DB<1> n IO::Handle at j line 6. at j line 6. main::(j:7): $proc->stdin->print("x\n"); DB<1> n mark@mlt:~/src/sys-cmd$ #### main::(j:5): my $proc = spawn( sub { print "hello\n" } ); DB<1> n main::(j:6): warn ref $proc->stdin; DB<1> n IO::Handle at j line 6. at j line 6. main::(j:7): print {$proc->stdin} "x\n"; DB<1> n main::(j:7): print {$proc->stdin} "x\n"; DB<1> n mark@mlt:~/src/sys-cmd$ #### $ git clone -b unexpected-termination git://github.com/mlawren/sys-cmd $ cd sys-cmd $ ./unexpected-termination.pl Spawning process