Skip to content

Commit

Permalink
fixup! Fix an error when attempting to delete the tmp dirs on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
timwoj committed Dec 13, 2022
1 parent 167cc76 commit 2985f83
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions btest
Original file line number Diff line number Diff line change
Expand Up @@ -1091,12 +1091,7 @@ class Test(object):
if not success:
self.mgr.testSkipped(self)
if not self.mgr_data["Options"].tmps:
# Close these here, since the rm command in rmtmp will return an error on
# windows if the files are still open.
self.log.close()
self.stdout.close()
self.stderr.close()
self.rmTmp()
self.rmTmp(with_close=True)
self.finish()
return

Expand Down Expand Up @@ -1243,12 +1238,7 @@ class Test(object):
self.mgr.testSucceeded(self)

if not self.mgr_data['Options'].tmps and self.reruns == 0:
# Close these here, since the rm command in rmtmp will return an error on
# windows if the files are still open.
self.log.close()
self.stdout.close()
self.stderr.close()
self.rmTmp()
self.rmTmp(with_close=True)

self.finish()

Expand Down Expand Up @@ -1359,7 +1349,12 @@ class Test(object):
self.diagmsgs += ["'%s' failed unexpectedly (exit code %s)" % (cmdline, rc)]
return False, rc

def rmTmp(self):
def rmTmp(self, with_close=False):
if with_close:
self.log.close()
self.stdout.close()
self.stderr.close()

try:
if os.path.isfile(self.tmpdir):
os.remove(self.tmpdir)
Expand Down

0 comments on commit 2985f83

Please sign in to comment.