Before, we were doing something like the following:
subprocess.call('command > test.run.stdout 2> test.run.stderr')
On Windows (msys2), it was somehow possible for this command to succeed,
without actually creating the output files (they show up a bit later).
This causes some tests to sporadically fail (e.g. T7037), because we
read those output files right after we write them.
To fix it, we now do:
stdout = open('test.run.stdout') stderr = open('test.run.stderr') subprocess.call('command', stdout=stdout, stderr=stderr) stdout.close() stderr.close()
This whole thing was a known issue, as evidenced by a comment in
"On Windows, if the program fails very early, it seems the
files stdout/stderr are redirected to may not get created"
I'm also wondering why we redirect stdout/stderr to file in the first
place, since we're going to read those files shortly after, and then
delete them when CLEANUP=1. But that's for another time.