aboutsummaryrefslogtreecommitdiff
path: root/src/tests/procs.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-12-21 17:56:32 +0000
committerMike Buland <eichlan@xagasoft.com>2009-12-21 17:56:32 +0000
commit184669188717673c4cb36698192fe8c14aa3af68 (patch)
treea91583c0e383a38852d6b64f3bebd5778630c0bb /src/tests/procs.cpp
parent5399dd17a944464ced0c8618c46a367e4188d29b (diff)
downloadlibbu++-184669188717673c4cb36698192fe8c14aa3af68.tar.gz
libbu++-184669188717673c4cb36698192fe8c14aa3af68.tar.bz2
libbu++-184669188717673c4cb36698192fe8c14aa3af68.tar.xz
libbu++-184669188717673c4cb36698192fe8c14aa3af68.zip
Ok, Process has been updated. You now must specify flags as the first parameter
of both constructors, this allows you to control which streams to bind to. To preserve the old behaviour, simply put Bu::Process::StdOut before your old first parameters.
Diffstat (limited to '')
-rw-r--r--src/tests/procs.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/tests/procs.cpp b/src/tests/procs.cpp
index 4f177c9..d914324 100644
--- a/src/tests/procs.cpp
+++ b/src/tests/procs.cpp
@@ -11,21 +11,25 @@
11 11
12int main() 12int main()
13{ 13{
14 //Bu::Process p( argv[1], argv+1 ); 14 Bu::Process p( Bu::Process::Both, "/bin/bash", "/bin/bash", "-c", "echo Hello 1>&2; echo StdOut; sleep 1; echo Yup; echo Yup 1>&2", NULL );
15 Bu::Process p("mplayer", "mplayer", "dvd://", "-framedrop",
16 "-ao", "null", "-nosound", "-vf", "framestep=I,cropdetect", "-sstep",
17 "197", NULL );
18 15
19 char buf[1000]; 16 char buf[1000];
20 for(;;) 17 while( !p.isEos() )
21 { 18 {
22 int iSize = p.read( buf, 1000 ); 19 bool out, err;
23 printf("::read=%d::\n", iSize ); 20 p.select( out, err );
24 if( iSize == 0 ) 21 if( out )
25 break; 22 {
26 fwrite( buf, iSize, 1, stdout ); 23 int iSize = p.read( buf, 1000 );
27 if( iSize < 1000 ) 24 printf("::read=%d::\n", iSize );
28 break; 25 fwrite( buf, iSize, 1, stdout );
26 }
27 if( err )
28 {
29 int iSize = p.readErr( buf, 1000 );
30 printf("::readErr=%d::\n", iSize );
31 fwrite( buf, iSize, 1, stdout );
32 }
29 } 33 }
30 34
31 return 0; 35 return 0;