Commit 8ff77da0 authored by jinkaiqiang's avatar jinkaiqiang

linux上执行会报文件被占用的错误,增加延迟时间

parent 89fda4f2
Pipeline #28943 passed with stage
in 21 seconds
import os import os
import shutil import shutil
import stat import stat
import time
import git import git
from flask import Flask from flask import Flask
...@@ -34,9 +35,9 @@ def readonly_handler(func, path, execinfo): ...@@ -34,9 +35,9 @@ def readonly_handler(func, path, execinfo):
这里需要实现文件权限修改的回调函数,通过onerror带入。 这里需要实现文件权限修改的回调函数,通过onerror带入。
''' '''
os.chmod(path, stat.S_IWRITE) os.chmod(path, stat.S_IWRITE)
time.sleep(0.5)
func(path) func(path)
if os.path.exists(git_path): if os.path.exists(git_path):
shutil.rmtree(git_path, onerror=readonly_handler) shutil.rmtree(git_path, onerror=readonly_handler)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment