File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import time
2- import uuid
3- import shutil
41import os
5- import sys
2+ import shutil
63import stat
4+ import time
5+ import uuid
76
87
98def setup_workspace (folder ):
@@ -20,18 +19,14 @@ def setup_workspace(folder):
2019 return log_file , working_dir
2120
2221
23- def on_rm_error (func , path , exc_info ):
24- st = os .stat (path )
25- os .chmod (path , st .st_mode | stat .S_IWRITE )
22+ def cleanup_workspace (working_dir ):
23+ if not os .path .exists (working_dir ):
24+ return
25+ st = os .stat (working_dir )
26+ os .chmod (working_dir , st .st_mode | stat .S_IWRITE )
2627
2728 time .sleep (0.5 )
2829 try :
29- func ( path )
30+ shutil . rmtree ( working_dir )
3031 except Exception :
3132 pass
32-
33- def cleanup_workspace (working_dir ):
34- if sys .version_info >= (3 , 12 ):
35- shutil .rmtree (working_dir , onexc = on_rm_error )
36- else :
37- shutil .rmtree (working_dir , onerror = on_rm_error )
You can’t perform that action at this time.
0 commit comments