From 50769be644114f1d45b632fef56e325ec082328c Mon Sep 17 00:00:00 2001 From: ishmal Date: Wed, 4 Jun 2008 19:41:06 +0000 Subject: [PATCH] improve piping --- buildtool.cpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/buildtool.cpp b/buildtool.cpp index 414c8e3fc..471a8194c 100644 --- a/buildtool.cpp +++ b/buildtool.cpp @@ -38,7 +38,7 @@ * */ -#define BUILDTOOL_VERSION "BuildTool v0.9.2" +#define BUILDTOOL_VERSION "BuildTool v0.9.3" #include #include @@ -3551,14 +3551,31 @@ void MakeBase::error(const char *fmt, ...) void MakeBase::status(const char *fmt, ...) { va_list args; - va_start(args,fmt); //fprintf(stdout, " "); + va_start(args,fmt); vfprintf(stdout, fmt, args); + va_end(args); fprintf(stdout, "\n"); + fflush(stdout); +} + + +/** + * Print a printf()-like formatted trace message + */ +void MakeBase::trace(const char *fmt, ...) +{ + va_list args; + fprintf(stdout, "Make: "); + va_start(args,fmt); + vfprintf(stdout, fmt, args); va_end(args) ; + fprintf(stdout, "\n"); + fflush(stdout); } + /** * Resolve another path relative to this one */ @@ -3571,20 +3588,6 @@ String MakeBase::resolve(const String &otherPath) } -/** - * Print a printf()-like formatted trace message - */ -void MakeBase::trace(const char *fmt, ...) -{ - va_list args; - va_start(args,fmt); - fprintf(stdout, "Make: "); - vfprintf(stdout, fmt, args); - fprintf(stdout, "\n"); - va_end(args) ; -} - - /** * Check if a given string matches a given regex pattern @@ -4048,8 +4051,10 @@ bool MakeBase::executeCommand(const String &command, #else //do it unix-style + String pipeCommand = command; + pipeCommand.append(" 2>&1"); String s; - FILE *f = popen(command.c_str(), "r"); + FILE *f = popen(pipeCommand.c_str(), "r"); int errnum = 0; if (f) { -- 2.30.2