While working on an unit test for a piece of C++ code that I once wrote to start an ALSA aplay process I noticed that sometimes I did not get a finished signal from the QProcess object, even if the specific aplay process was started and finished properly. While debugging it, even a QProcess::waitForFinished did not return (within the given timeout).

So what was the cause for this strange behaviour? Although I wrote the first implementation using fork and exec, the class was rewritten for the most part by a co-worker who introduced Qt mechanisms in the program. While my use of fork/exec it was refactored with QProcess, a signal() handler to prune old child processes so the would not stick around as zombies was left:

signal(SIGCHLD, SIG_IGN);

After removing this line of code, the QProcess object behaved correctly during runtime.

The lesson here is, that legacy signal() handlers may interfere with the use QProcess, which is in hindsight not surprising at all.

Updated: