Skip to content

Commit 0a3b083

Browse files
committed
[debuginfo-tests] Warn, not error, if we can't delete working directory
On Windows, an error running the debugger typically leaves a process hanging around in the working directory. When Dexter exits, it can't then delete the working directory and produces an exception, masking the problem in the debugger. (This can be worked around by specifying --save-temps). Rather than hard-erroring, print a warning when we can't delete the working directory instead. It'd be much better to improve our error handling, and make the WorkingDirectory class aware that something's wrong when it enters exit. However, this is something that's going to mask genuine errors and make everyones lives harder right now, so I think this non-ideal fix is important to get in first. Differential Revision: https://reviews.llvm.org/D74548
1 parent bdb24fa commit 0a3b083

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

debuginfo-tests/dexter/dex/utils/WorkingDirectory.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import time
1313

1414
from dex.utils.Exceptions import Error
15-
15+
from dex.utils.Warning import warn
1616

1717
class WorkingDirectory(object):
1818
def __init__(self, context, *args, **kwargs):
@@ -35,12 +35,12 @@ def __exit__(self, *args):
3535
self.path))
3636
return
3737

38-
exception = AssertionError('should never be raised')
3938
for _ in range(100):
4039
try:
4140
shutil.rmtree(self.path)
4241
return
43-
except OSError as e:
44-
exception = e
42+
except OSError:
4543
time.sleep(0.1)
46-
raise Error(exception)
44+
45+
warn(self.context, '"{}" left in place (couldn\'t delete)\n'.format(self.path))
46+
return

0 commit comments

Comments
 (0)