in reply to Problem redirecting STDOUT/STDERR
It seems to me that the debugger would lose some utility if it printed all its output to a log. Anyhow...
You might try localizing the handles,
Why do you use non-blocking? That will cause you to exit instead of waiting until the file is available. I also don't see why you need truncate, following. You already clobbered the old log when you opened STDOUT.{ open local(*STDOUT), "> $log" or die $!; open local(*STDERR), ">>&STDOUT" or die $!; flock(STDOUT, LOCK_EX | LOCK_NB) or die $!;
I don't know whether $pkunzip makes use of the current directory, but it wouldn't hurt to use Cwd 'chdir'; before this, so that directory changes get into the child's environment.truncate STDOUT, 0; #clear out STDOUT to start with a fresh log fi +le. chdir $local_dir or die "Cannot change to $local_dir. $!";
I rewrote the system call to avoid going through the shell. You'll need to call glob yourself if you've been relying on the shell to expand file names to a list.system $pkunzip, '-doA', "$local_dir/$file"; }
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Problem redirecting STDOUT/STDERR
by nimdokk (Vicar) on Jan 16, 2004 at 18:41 UTC |