From 7cbd14270b720d1fc6c6b441851099a4c6de8b5c Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Mon, 21 May 2018 20:04:49 +0200 Subject: [PATCH] Uh, no output captured? Engage "ultra lazy mode": monkeypatch all the things! --- bld.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bld.py b/bld.py index e440b0f..27dc68c 100644 --- a/bld.py +++ b/bld.py @@ -1,6 +1,8 @@ from __future__ import print_function +from functools import partial from os.path import exists +import subprocess import sys from time import sleep @@ -13,10 +15,16 @@ def rm_rf(path, config=None): with captured() as c: + check_call = subprocess.check_call try: + subprocess.check_call = partial( + check_call, stdout=sys.stdout, stderr=sys.stderr, close_fds=False, + ) _rm_rf(path, config=config) except OSError: pass + finally: + subprocess.check_call = check_call for output, stream in ((c.stdout, sys.stdout), (c.stderr, sys.stderr)): if output: print(