Skip to content

Commit

Permalink
Uh, no output captured? Engage "ultra lazy mode": monkeypatch all the…
Browse files Browse the repository at this point in the history
… things!
  • Loading branch information
mbargull committed May 21, 2018
1 parent 49de8cc commit 7cbd142
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bld.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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(
Expand Down

0 comments on commit 7cbd142

Please sign in to comment.