This problem is similar to the Blackberry problem.
Whenever we create a CFSocket in qcfsocketnotifier.cpp (due to the Cocoa-based event loop for the GUI thread), it registers the socket for notification with an outside source (kevent, threads, whatever). That is incompatible with the select()-based loop we have in qprocess_unix.cpp.
The attached "bad" output of dtruss shows that the following happens (note, dtruss output is not ordered, you should sort by thread CPU time):
- parent process stops in select(), waiting for input from child (this is QProcess::waitForReadyRead)
- child process writes "hello world"
- parent process reads, first by doing an ioctl with FIONREAD
- parent process goes into the CFRunLoop-based processEvents()
- the socket notifier for the stdout channel is activated
- parent process tries to read, but this time ioctl reported 0 bytes available
- parent process closes stdout channel
- child process writes to stdout and gets EPIPE and dies from SIGPIPE
|For Gerrit Dashboard: QTBUG-39488|
|86946,7||QProcess: Handle spurious socket notifications for stdout and stderr||5.3||qt/qtbase||Status: MERGED||+2||0|