-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
When you run a process, it can write some data to the standard output (or error).
Example:
p := OSSUnixSubprocess new
command: '/bin/bash';
arguments: #('-c' '/tmp/pharo-vm/Pharo.app/Contents/MacOS/Pharo /tmp/Pharo.image eval "[ 70 timesRepeat: [ Stdio stderr nextPutAll: (String loremIpsum: 1024). 0.01 second wait. ] ] fork"');
run.If you run the process without trying to read the standard error, everything is fine.
Then, if you run the same process, listening to the standard error, the launched process will freeze.
p := OSSUnixSubprocess new
command: '/bin/bash';
arguments: #('-c' '/tmp/pharo-vm/Pharo.app/Contents/MacOS/Pharo /tmp/Pharo.image eval "[ 70 timesRepeat: [ Stdio stderr nextPutAll: (String loremIpsum: 1024). 0.01 second wait. ] ] fork"');
redirectStderr;
run.The standard streams have a maximum buffer. When this buffer is full, then the process is paused until someone reads in the buffer and empty it.
OSSubprocess should handle this case by providing a way to signal that data is available. It could be done by using non-blocking ffi calls to read the buffer.
Metadata
Metadata
Assignees
Labels
No labels