summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlxc_rootfs_debootstrap8
1 files changed, 8 insertions, 0 deletions
diff --git a/lxc_rootfs_debootstrap b/lxc_rootfs_debootstrap
index fcb21dd..71e79ef 100755
--- a/lxc_rootfs_debootstrap
+++ b/lxc_rootfs_debootstrap
@@ -314,6 +314,14 @@ class Bootstrapper:
if self._verbose > 1:
sys.stderr.write('Executing in chroot: %s\n' % cmdline)
+ # discard command's stdout/err on zero verbosity, as there's no general
+ # way to make all of them quiet
+ # failures should still be detected via return codes
+ if (self._verbose == 0 and
+ not any((it in kwargs for it in ('stdout', 'stderr', 'capture_output')))):
+ kwargs['stderr'] = subprocess.DEVNULL
+ kwargs['stdout'] = subprocess.DEVNULL
+
return subprocess.run(['chroot', self._root_path] + cmdline, check = True, **kwargs)
parser = argparse.ArgumentParser(description = description)