diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/procs.cpp | 28 |
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 | ||
12 | int main() | 12 | int 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; |