fix race condition in testStdOutErr and align with testStdOut, again