scripts: Fixed failed subprocess stderr, unconditionally forward
It looks like the failure case in our scripts' subprocess stderr
handling was not tested well during a fix to stderr blocking (a735bcd).
This code was attempting to print stderr only if an error occured, but
with stderr=None this just results in a NoneType TypeError.
In retrospect, completely hiding stderr is kind of shitty if a
subprocess fails, but it doesn't seem possible to read from both stdin
and stderr with Python's APIs without getting stuck when the stderr's
buffer is full.
It might be possible to work around this with either multithreading,
select calls, or a temp file, but I'm not sure slightly less verbose
scripts are worth the added complexity in every single subprocess call.
For now just reverting to unconditionally forwarding stderr from the
child process. This is the simplest/most robust option.
This commit is contained in:
@@ -742,7 +742,6 @@ def find_perms(runner, test_ids=[], **args):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
stdout=sp.PIPE,
|
||||
stderr=None if args.get('verbose') else sp.DEVNULL,
|
||||
universal_newlines=True,
|
||||
errors='replace',
|
||||
close_fds=False)
|
||||
@@ -763,9 +762,6 @@ def find_perms(runner, test_ids=[], **args):
|
||||
total_perms += perms
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
if not args.get('verbose'):
|
||||
for line in proc.stderr:
|
||||
sys.stderr.write(line)
|
||||
sys.exit(-1)
|
||||
|
||||
# get which suite each case belongs to via paths
|
||||
@@ -774,7 +770,6 @@ def find_perms(runner, test_ids=[], **args):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
stdout=sp.PIPE,
|
||||
stderr=None if args.get('verbose') else sp.DEVNULL,
|
||||
universal_newlines=True,
|
||||
errors='replace',
|
||||
close_fds=False)
|
||||
@@ -793,9 +788,6 @@ def find_perms(runner, test_ids=[], **args):
|
||||
case_suites[m.group('case')] = suite
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
if not args.get('verbose'):
|
||||
for line in proc.stderr:
|
||||
sys.stderr.write(line)
|
||||
sys.exit(-1)
|
||||
|
||||
# figure out expected suite perms
|
||||
@@ -820,7 +812,6 @@ def find_path(runner, id, **args):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
stdout=sp.PIPE,
|
||||
stderr=None if args.get('verbose') else sp.DEVNULL,
|
||||
universal_newlines=True,
|
||||
errors='replace',
|
||||
close_fds=False)
|
||||
@@ -836,9 +827,6 @@ def find_path(runner, id, **args):
|
||||
path = (path_, lineno)
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
if not args.get('verbose'):
|
||||
for line in proc.stderr:
|
||||
sys.stderr.write(line)
|
||||
sys.exit(-1)
|
||||
|
||||
return path
|
||||
@@ -851,7 +839,6 @@ def find_defines(runner, id, **args):
|
||||
print(' '.join(shlex.quote(c) for c in cmd))
|
||||
proc = sp.Popen(cmd,
|
||||
stdout=sp.PIPE,
|
||||
stderr=None if args.get('verbose') else sp.DEVNULL,
|
||||
universal_newlines=True,
|
||||
errors='replace',
|
||||
close_fds=False)
|
||||
@@ -865,9 +852,6 @@ def find_defines(runner, id, **args):
|
||||
defines[define] = value
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
if not args.get('verbose'):
|
||||
for line in proc.stderr:
|
||||
sys.stderr.write(line)
|
||||
sys.exit(-1)
|
||||
|
||||
return defines
|
||||
|
||||
Reference in New Issue
Block a user