in reply to Redirecting STDERR to STDOUT securely

Once again the manual saves the day, open:
defined (my $pid = open(FROM_CHILD, "-|")) or die "can't fork: $!"; if ($pid) { my @output = <FROM_CHILD>; wait; close FROM_CHILD; return @output; } else { open(STDERR, ">&STDOUT") || die "Can't dup stdout"; exec "/usr/bin/sudo", @command; die "can't exec: $!"; }

--
perl -p -e "s/(?:\w);([st])/'\$1/mg"

Replies are listed 'Best First'.
Re: Re: Redirecting STDERR to STDOUT securely
by nomis80 (Sexton) on Dec 12, 2001 at 21:42 UTC
    Thanks a lot, I've been enlightened.