Skip to content

Commit

Permalink
Use rm -rf for deleting temp directories on Windows too
Browse files Browse the repository at this point in the history
  • Loading branch information
timwoj committed Jan 4, 2023
1 parent 17df3c8 commit b703e50
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions btest
Original file line number Diff line number Diff line change
Expand Up @@ -1386,11 +1386,7 @@ class Test(object):
os.remove(self.tmpdir)

if os.path.isdir(self.tmpdir):
if sys.platform == 'win32':
win_path = pathlib.PureWindowsPath(self.tmpdir)
subprocess.call("rmdir /s /q %s" % (str(win_path)), shell=True)
else:
subprocess.call("rm -rf %s 2>/dev/null" % (self.tmpdir), shell=True)
subprocess.call("rm -rf %s 2>/dev/null" % self.tmpdir, stderr=subprocess.DEVNULL)

except OSError as e:
error("cannot remove tmp directory %s: %s" % (self.tmpdir, e))
Expand Down

0 comments on commit b703e50

Please sign in to comment.