summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-06-17 12:39:54 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-06-17 12:39:54 +0100
commit6dfd1b9c945f47969052a20095d667400befa076 (patch)
tree229cb92176f34aac0b826645ce5715da68cd32f1
parent17f7d8f2c807b3c419df8f0100aeb10585859ce0 (diff)
downloadsandboxlib-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.py6
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" % (