feature(keyringctl): print a stack trace in case a system cmd fails

This commit is contained in:
Levente Polyak 2021-10-21 20:18:21 +02:00
parent bc8c51749c
commit deaa312b7d
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8

View File

@ -26,6 +26,7 @@ from sys import exit
from sys import stderr
from tempfile import TemporaryDirectory
from tempfile import mkdtemp
from traceback import print_stack
from typing import Dict
from typing import List
from typing import NewType
@ -131,6 +132,7 @@ def system(cmd: List[str], exit_on_error: bool = True) -> str:
return check_output(cmd, stderr=PIPE).decode()
except CalledProcessError as e:
stderr.buffer.write(e.stderr)
print_stack()
if exit_on_error:
exit(e.returncode)
raise e