summaryrefslogtreecommitdiff
path: root/src/process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.cpp')
-rw-r--r--src/process.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/process.cpp b/src/process.cpp
index da38e64..7cb5983 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -66,6 +66,11 @@ Bu::Process::~Process()
66 close(); 66 close();
67} 67}
68 68
69void Bu::Process::wait()
70{
71 close();
72}
73
69void Bu::Process::gexec( Flags eFlags, const char *sName, char *const argv[] ) 74void Bu::Process::gexec( Flags eFlags, const char *sName, char *const argv[] )
70{ 75{
71 int iaStdIn[2]; 76 int iaStdIn[2];
@@ -258,13 +263,17 @@ void Bu::Process::setBlocking( bool bBlocking )
258{ 263{
259 if( bBlocking ) 264 if( bBlocking )
260 { 265 {
261 fcntl( iStdOut, F_SETFL, fcntl( iStdOut, F_GETFL, 0 )&(~O_NONBLOCK) ); 266 if( !bStdOutEos )
262 fcntl( iStdErr, F_SETFL, fcntl( iStdErr, F_GETFL, 0 )&(~O_NONBLOCK) ); 267 fcntl( iStdOut, F_SETFL, fcntl(iStdOut,F_GETFL,0 )&(~O_NONBLOCK) );
268 if( !bStdErrEos )
269 fcntl( iStdErr, F_SETFL, fcntl(iStdErr,F_GETFL,0 )&(~O_NONBLOCK) );
263 } 270 }
264 else 271 else
265 { 272 {
266 fcntl( iStdOut, F_SETFL, fcntl( iStdOut, F_GETFL, 0 )|O_NONBLOCK ); 273 if( !bStdOutEos )
267 fcntl( iStdErr, F_SETFL, fcntl( iStdErr, F_GETFL, 0 )|O_NONBLOCK ); 274 fcntl( iStdOut, F_SETFL, fcntl( iStdOut, F_GETFL, 0 )|O_NONBLOCK );
275 if( !bStdErrEos )
276 fcntl( iStdErr, F_SETFL, fcntl( iStdErr, F_GETFL, 0 )|O_NONBLOCK );
268 } 277 }
269 this->bBlocking = bBlocking; 278 this->bBlocking = bBlocking;
270} 279}
@@ -293,6 +302,8 @@ void Bu::Process::select( bool &bStdOut, bool &bStdErr )
293 302
294bool Bu::Process::isRunning() 303bool Bu::Process::isRunning()
295{ 304{
305 if( waitpid( iPid, NULL, WNOHANG ) == iPid )
306 close();
296 return iPid != 0; 307 return iPid != 0;
297} 308}
298 309