mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
utils/misc: Ensure outputs are strings when raising exceptions
If the process was killed, either the output or error can be `None` which causes an error when attempting to join the outputs. Also update existing error message to prevent 'None' appearing in the error message.
This commit is contained in:
parent
9fd690efb3
commit
c4ababcd50
@ -192,9 +192,9 @@ def check_output(command, timeout=None, ignore=None, inputtext=None,
|
||||
retcode = process.poll()
|
||||
if retcode:
|
||||
if retcode == -9: # killed, assume due to timeout callback
|
||||
raise TimeoutError(command, output='\n'.join([output, error]))
|
||||
raise TimeoutError(command, output='\n'.join([output or '', error or '']))
|
||||
elif ignore != 'all' and retcode not in ignore:
|
||||
raise subprocess.CalledProcessError(retcode, command, output='\n'.join([str(output), str(error)]))
|
||||
raise subprocess.CalledProcessError(retcode, command, output='\n'.join([output or '', error or '']))
|
||||
return output, error
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user