【发布时间】:2012-12-06 08:28:32
【问题描述】:
可能重复:
How do you capture stderr, stdout, and the exit code all at once, in Perl?
Capturing the output of STDERR while piping STDOUT to a file
我正在使用以下代码来执行一个进程:
open( my $proch, "-|", $command, @arguments );
不幸的是,我只会阅读 stdout。但我也想阅读 stderr。
Stderr 重定向导致如下错误:
open( my $proch, "2>&1 -|", $command, @arguments );
>>> Unknown open() mode '2>&1 -|' at file.pl line 289
如何将 stderr 转发到 stdout?
【问题讨论】: