upgrade to python3
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user