upgrade to python3

This commit is contained in:
2026-02-08 11:23:34 +08:00
parent 487c041148
commit 9b20887cc2
9 changed files with 139 additions and 195 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python2.6
#!/usr/bin/env python3
import os, signal, sys, time
from resource import setrlimit, RLIMIT_AS
@@ -38,7 +39,8 @@ def main():
pid = configs[conf]
ret = os.waitpid(pid, os.WNOHANG)
if ret[0]:
print >>sys.stderr, 'judge process %d dead, restarting...' % pid
print('judge process %d dead, restarting...' % pid, file=sys.stderr)
configs[conf] = run(conf)
time.sleep(1)
@@ -47,7 +49,8 @@ def run(conf):
if pid:
return pid
else:
cmd = '/usr/bin/python'
cmd = sys.executable
conf = os.path.join('conf', conf)
os.execvp(cmd, (cmd, 'judge', conf))