From 2985f83477449c9a09cf9f62ed919e8ecec563e6 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Tue, 13 Dec 2022 11:14:40 -0700 Subject: [PATCH] fixup! Fix an error when attempting to delete the tmp dirs on Windows --- btest | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/btest b/btest index b470bddf..4304c366 100755 --- a/btest +++ b/btest @@ -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 @@ -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() @@ -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)