modified: ri_oper.py

add signal pipe
This commit is contained in:
fling
2010-11-01 08:58:59 +08:00
parent df515ef85e
commit cc89dfd6f3

View File

@@ -78,6 +78,7 @@ class Operation:
max = Rate.value+self.score <100 and Rate.value+self.score or 100
process = subprocess.Popen("./%s " %self.script + ' '.join(self.get_arguments()),\
stdin=subprocess.PIPE,stdout=subprocess.PIPE, shell=True, \
preexec_fn=self.sigpipe_handle, \
cwd="%s/../operation" %os.path.split(os.path.realpath(__file__))[0])
process.stdin.write(self.get_stdin())
process.stdin.close()
@@ -96,6 +97,9 @@ class Operation:
if display_scale: display_scale()
return ret
def sigpipe_handle(self):
signal.signal(signal.SIGPIPE,signal.SIG_DFL)
def get_arguments(self):
return []
def get_stdin(self):