From 7cd3655e2e3edc630b21e495438c4b324c50c759 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 18 Jun 2010 19:49:31 +0000 Subject: Fixed some things that broke when Process changed it's functionality slightly. --- src/context.cpp | 6 ++++-- src/functionexecute.cpp | 3 ++- src/functiongetmakedeps.cpp | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index 64b3bd0..1125248 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -220,11 +220,13 @@ Bu::FString Context::expand( const Bu::FString &sInS ) { //sio << "Executing command: >>>" << sCmd << "<<<" << sio.nl; Process p( Process::StdOut, "/bin/bash", "/bin/bash", "-c", sCmd.getStr(), NULL ); - while( p.isRunning() ) + char buf[4096]; + do { - char buf[4096]; sBuf.append( buf, p.read( buf, 4096 ) ); } + while( p.isRunning() ); + sBuf.append( buf, p.read( buf, 4096 ) ); sBuf = sBuf.replace("\n", " ").replace("\r", " "); sBuf.trimBack(' '); sRet.append( sBuf ); diff --git a/src/functionexecute.cpp b/src/functionexecute.cpp index f692036..0b0aabf 100644 --- a/src/functionexecute.cpp +++ b/src/functionexecute.cpp @@ -31,7 +31,7 @@ Variable FunctionExecute::call( Variable &/*input*/, VarList lParams ) Process pCmd( Process::Both, "/bin/bash", "/bin/bash", "-c", lParams.first().getString().getStr(), NULL ); FString sStdOut, sStdErr; - while( pCmd.isRunning() ) + do { char buf[4096]; bool out, err; @@ -49,6 +49,7 @@ Variable FunctionExecute::call( Variable &/*input*/, VarList lParams ) //sio << "Read " << iRead << " bytes of stdout." << sio.nl; } } + while( pCmd.isRunning() ); pContext->getView()->cmdFinished( sStdOut, sStdErr, pCmd.childExitStatus() diff --git a/src/functiongetmakedeps.cpp b/src/functiongetmakedeps.cpp index cc6cbbb..cfe5459 100644 --- a/src/functiongetmakedeps.cpp +++ b/src/functiongetmakedeps.cpp @@ -31,12 +31,13 @@ Variable FunctionGetMakeDeps::call( Variable &/*input*/, VarList lParams ) // Gather all data from the command. Bu::FString sBuf; - while( !p.isEos() ) + do { char buf[4096]; int iRead = p.read( buf, 4096 ); sBuf.append( buf, iRead ); } + while( !p.isEos() ); pContext->getView()->cmdFinished( "", "", p.childExitStatus() ); -- cgit v1.2.3