def restartInProcess(self, app):
import fcntl
args = sys.argv[:]
args.insert(0, sys.executable)
apppath = j.system.fs.joinPaths(j.dirs.appDir, app)
max_fd = 1024
for fd in range(3, max_fd):
try:
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
except IOError:
continue
fcntl.fcntl(fd, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC)
os.chdir(apppath)
os.execv(sys.executable, args)
评论列表
文章目录