PBeginner has asked for the wisdom of the Perl Monks concerning the following question:
Iam new to Perl on Windows and hence landed up here. I need to run du command in the background within the perl script on windows which takes some 5mins. Also i need to capture the output of this command to a file. I searched many forums and could understand Proc::Background suits the best. But iam not sure how to capture the output. Below is the thing i tried.
use Proc::Background; my $cmd="du(qw//usr/bin//); my $proc=Proc::Background->new($cmd); my $alive=$proc->alive; my $pid=$proc->pid; print "pid is $pid\n";
Now iam struck how to capture output of the du cmd.Please suggest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: running a cmd in background and capturing the output
by Corion (Patriarch) on Oct 09, 2013 at 10:27 UTC | |
|
Re: running a cmd in background and capturing the output
by dasgar (Priest) on Oct 09, 2013 at 12:51 UTC | |
|
Re: running a cmd in background and capturing the output
by Anonymous Monk on Oct 09, 2013 at 12:14 UTC | |
|
Re: running a cmd in background and capturing the output
by Laurent_R (Canon) on Oct 09, 2013 at 18:50 UTC | |
by PBeginner (Initiate) on Oct 10, 2013 at 05:21 UTC |