in reply to not waiting for external command to complete before getting the output
#!/usr/bin/perl use warnings; use strict; use IPC::Open3; my $pid = open3(\*WRITE, \*READ,0,"/usr/bin/cdrecord -v -dummy -eject +/mnt/my.iso"); #if \*ERROR is false, STDERR is sent to STDOUT #while(1){ #select(undef,undef,undef,.01); chomp(my $output = <READ>); print "$output\n"; #do some split and test to extract percentage #} waitpid($pid, 1); # It is important to waitpid on your child process, # otherwise zombies could be created.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: not waiting for external command to complete before getting the output
by Anonymous Monk on Apr 27, 2004 at 19:05 UTC | |
by zentara (Cardinal) on Apr 28, 2004 at 16:12 UTC |