vm: raise CalledProcessError on failed service/command call

This commit is contained in:
Marek Marczykowski-Górecki 2017-06-20 17:09:01 +02:00
parent 51a17ba749
commit 60443259d0
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -1095,10 +1095,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
stdouterr = yield from p.communicate(input=input)
if p.returncode:
raise qubes.exc.QubesVMError(self,
'service {!r} failed with retcode {!r}; '
'stdout={!r} stderr={!r}'.format(
args[0], p.returncode, *stdouterr))
raise subprocess.CalledProcessError(p.returncode,
args[0], *stdouterr)
return stdouterr
@ -1142,10 +1140,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
stdouterr = yield from p.communicate(input=input)
if p.returncode:
raise qubes.exc.QubesVMError(self,
'service {!r} failed with retcode {!r}; '
'stdout={!r} stderr={!r}'.format(
args[0], p.returncode, *stdouterr))
raise subprocess.CalledProcessError(p.returncode,
args[0], *stdouterr)
return stdouterr