diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-17 12:39:54 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2015-06-17 12:39:54 +0100 |
commit | 6dfd1b9c945f47969052a20095d667400befa076 (patch) | |
tree | 229cb92176f34aac0b826645ce5715da68cd32f1 | |
parent | 17f7d8f2c807b3c419df8f0100aeb10585859ce0 (diff) | |
download | sandboxlib-6dfd1b9c945f47969052a20095d667400befa076.tar.gz |
chroot: Capture output of mount/unmount commands0.3.1
This fixes a crash if the command fails, because we would try to decode
'err' but it would be None because output was not being captured.
-rw-r--r-- | sandboxlib/chroot.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sandboxlib/chroot.py b/sandboxlib/chroot.py index c0f662b..b5d2da5 100644 --- a/sandboxlib/chroot.py +++ b/sandboxlib/chroot.py @@ -103,7 +103,8 @@ def mount(source, path, mount_type, mount_options): # should do that instead. argv = [ 'mount', '-t', mount_type, '-o', mount_options, source, path] - exit, out, err = sandboxlib._run_command(argv, stdout=None, stderr=None) + exit, out, err = sandboxlib._run_command( + argv, stdout=sandboxlib.CAPTURE, stderr=sandboxlib.CAPTURE) if exit != 0: raise RuntimeError( @@ -113,7 +114,8 @@ def mount(source, path, mount_type, mount_options): def unmount(path): argv = ['umount', path] - exit, out, err = sandboxlib._run_command(argv, stdout=None, stderr=None) + exit, out, err = sandboxlib._run_command( + argv, stdout=sandboxlib.CAPTURE, stderr=sandboxlib.CAPTURE) if exit != 0: warnings.warn("%s failed: %s" % ( |