[cfe-commits] r56130 - /cfe/trunk/utils/ccc-analyzer
Ted Kremenek
kremenek at apple.com
Thu Sep 11 16:05:26 PDT 2008
Author: kremenek
Date: Thu Sep 11 18:05:26 2008
New Revision: 56130
URL: http://llvm.org/viewvc/llvm-project?rev=56130&view=rev
Log:
Echo stderr/stdout from clang subprocess to both the stderr of ccc-analyzer and
to an output file. This way users can both see the output of 'clang' as well as
enable background logging of files that clang encounters problems on.
Modified:
cfe/trunk/utils/ccc-analyzer
Modified: cfe/trunk/utils/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ccc-analyzer?rev=56130&r1=56129&r2=56130&view=diff
==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Thu Sep 11 18:05:26 2008
@@ -117,15 +117,24 @@
# Capture the STDOUT of clang and reroute it to ccc-analyzer's STDERR.
# We save the output file in the 'crashes' directory if clang encounters
# any problems with the file.
- my ($ofh, $ofile) = tempfile("clang_output_XXXXXX", DIR => $HtmlDir);
+ pipe (FROM_CHILD, TO_PARENT);
my $pid = fork();
if ($pid == 0) {
- open(STDOUT,">&", \*STDERR);
- open(STDERR,">&", $ofh);
+ close FROM_CHILD;
+ open(STDOUT,">&", \*TO_PARENT);
+ open(STDERR,">&", \*TO_PARENT);
exec $Cmd, @CmdArgs;
}
- close ($ofh);
- wait;
+
+ close TO_PARENT;
+ my ($ofh, $ofile) = tempfile("clang_output_XXXXXX", DIR => $HtmlDir);
+
+ while (<FROM_CHILD>) {
+ print $ofh $_;
+ print STDERR $_;
+ }
+
+ waitpid($pid,0);
my $Result = $?;
# Did the command die because of a signal?
More information about the cfe-commits
mailing list