aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-09-16 17:37:54 +0000
committerMike Buland <eichlan@xagasoft.com>2011-09-16 17:37:54 +0000
commit9945d6c97f8b97c5647cd1b61640df73be83cad7 (patch)
tree17d8d120ca277f00f42a5b44f1b7f7e77f541ce6 /src
parent6df767863656d2e3efffed562a02180b3ea11624 (diff)
downloadlibbu++-9945d6c97f8b97c5647cd1b61640df73be83cad7.tar.gz
libbu++-9945d6c97f8b97c5647cd1b61640df73be83cad7.tar.bz2
libbu++-9945d6c97f8b97c5647cd1b61640df73be83cad7.tar.xz
libbu++-9945d6c97f8b97c5647cd1b61640df73be83cad7.zip
More helper functions for Bu::Process.
Diffstat (limited to '')
-rw-r--r--src/process.cpp17
-rw-r--r--src/process.h2
2 files changed, 17 insertions, 2 deletions
diff --git a/src/process.cpp b/src/process.cpp
index e6b9f3d..55824ae 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -176,8 +176,9 @@ void Bu::Process::close()
176{ 176{
177 if( iPid ) 177 if( iPid )
178 { 178 {
179 ::close( iStdIn ); 179 if( iStdIn > -1 )
180 if( iStdErr > -1 ) 180 ::close( iStdIn );
181 if( iStdOut > -1 )
181 ::close( iStdOut ); 182 ::close( iStdOut );
182 if( iStdErr > -1 ) 183 if( iStdErr > -1 )
183 ::close( iStdErr ); 184 ::close( iStdErr );
@@ -186,6 +187,18 @@ void Bu::Process::close()
186 } 187 }
187} 188}
188 189
190void Bu::Process::closeStdIn()
191{
192 ::close( iStdIn );
193 iStdIn = -1;
194}
195
196void Bu::Process::closeStdOut()
197{
198 ::close( iStdOut );
199 iStdOut = -1;
200}
201
189Bu::size Bu::Process::read( void *pBuf, Bu::size nBytes ) 202Bu::size Bu::Process::read( void *pBuf, Bu::size nBytes )
190{ 203{
191 if( bStdOutEos ) 204 if( bStdOutEos )
diff --git a/src/process.h b/src/process.h
index 6295b49..d6282e0 100644
--- a/src/process.h
+++ b/src/process.h
@@ -63,6 +63,8 @@ namespace Bu
63 void wait(); 63 void wait();
64 64
65 virtual void close(); 65 virtual void close();
66 virtual void closeStdIn();
67 virtual void closeStdOut();
66 virtual Bu::size read( void *pBuf, Bu::size nBytes ); 68 virtual Bu::size read( void *pBuf, Bu::size nBytes );
67 virtual Bu::size readErr( void *pBuf, Bu::size nBytes ); 69 virtual Bu::size readErr( void *pBuf, Bu::size nBytes );
68 virtual Bu::size write( const void *pBuf, Bu::size nBytes ); 70 virtual Bu::size write( const void *pBuf, Bu::size nBytes );