tracefile: Output from cmd on stdout can mess up output from strace.

This commit is contained in:
Ole Tange 2019-03-05 22:13:01 +01:00
parent cbaa61fd78
commit 4c0e59272a

View file

@ -256,7 +256,8 @@ my @cmd = shell_quote(@ARGV);
my $dir = "."; my $dir = ".";
my $pid = $opt::pid ? "-p $opt::pid" : ""; my $pid = $opt::pid ? "-p $opt::pid" : "";
open(IN, "-|", "strace -ff $pid -e trace=file @cmd 2>&1") || die; # BUG: If command gives output on stderr that can confuse the strace output
open(IN, "-|", "strace -ff $pid -e trace=file @cmd 2>&1 >/dev/null") || die;
while(<IN>) { while(<IN>) {
if(/chdir."(([^\\"]|\\[\\"nt])*)".\s*=\s*0/) { if(/chdir."(([^\\"]|\\[\\"nt])*)".\s*=\s*0/) {
$dir = $1; $dir = $1;