diff --git a/bld.py b/bld.py index 27dc68c..409c98f 100644 --- a/bld.py +++ b/bld.py @@ -1,12 +1,8 @@ from __future__ import print_function -from functools import partial -from os.path import exists import subprocess import sys -from time import sleep -from conda.common.io import captured from conda_build.cli.main_build import main import conda_build.utils @@ -14,28 +10,17 @@ def rm_rf(path, config=None): - with captured() as c: - check_call = subprocess.check_call + _check_call = subprocess.check_call + def check_call(ps_open_args, *args, **kwargs): + if isinstance(ps_open_args, str): + ps_open_args = ps_open_args.replace('rd /s /q', 'del /F/S/Q') + print('>>>>>> running monkeypatched call:', ps_open_args, file=sys.stderr) + return _check_call(ps_open_args, *args, **kwargs) try: - subprocess.check_call = partial( - check_call, stdout=sys.stdout, stderr=sys.stderr, close_fds=False, - ) + subprocess.check_call = check_call _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( - *( - line for line in output.splitlines() - if not line.endswith(' - Access is denied.') - ), - sep='\n', file=stream) - if exists(path): - sleep(0.1) - _rm_rf(path, config=config) + subprocess.check_call = _check_call conda_build.utils.rm_rf = rm_rf