fix news and move force logic out of try

This commit is contained in:
christopher 2018-07-19 10:43:14 -04:00
parent 3fef5198c8
commit e47633acb2
2 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,6 @@
**Added:**
* ``xonsh.lib.rmtree()`` an rmtree which works on windows properly (even with
* ``xonsh.lib.os.rmtree()`` an rmtree which works on windows properly (even with
git)
**Changed:** None

View file

@ -24,11 +24,11 @@ def rmtree(dirname, force=False):
force : bool
If True force removal, defaults to False
"""
cmd_args = '-r'
if force:
cmd_args += 'f'
try:
if force:
rm -rf @(dirname)
else:
rm -r @(dirname)
rm @(cmd_args) @(dirname)
except PermissionError:
if sys.platform == "win32":
del /F/S/Q @(dirname)