On Mon, Nov 28, 2011 at 06:03:18AM -0800, Sean P. DeNigris wrote:
David T. Lewis wrote
PipeableOSProcess is designed...
I learned a lot from your answer (I always forget I can chain them together), but I'm not clear whether it answered my question :)
Let me rephrase... In my original example: PipeableOSProcess command: '/usr/local/bin/HandBrakeCLI -e x264 -q 20 -m --start-at duration:1 --stop-at duration:5 -i /Volumes/DISK_01 -o "/path/to/DISK_01.mp4"'
As a naive user, I would assume that "p errorUpToEnd" would show me the error output. I found that it did not unless I first sent "p updateErrorPipelineStream". From your answer, it sounds like the error stream should be automatically notified and updated when new data is available, but this doesn't seem to be happening.
Try using #errorUpToEndOfFile rather than #errorUpToEnd. This will wait for all available data, as opposed to just the data that is currently available.
The reason that you are getting an empty string is that you are reading errorUpToEnd before that error output has been completely updated. The data will not be available until the external process has written it to its stderr, flushed the steam (usually by exiting), and your Squeak VM has detected data available, your OSProcess has read the data, and all of those buffered streams have been updated. This all takes place asynchronously with semaphores being signaled and background processes waking up to update the data.
You can also illustrate this simply by inserting a delay between starting the command and reading its error output. If you wait for a few hundred milliseconds, the data will magically appear and the errorUpToEnd will now give you the results you expect.
HTH, Dave