From cc89dfd6f3cbb414205228021d7212ff9d305f82 Mon Sep 17 00:00:00 2001 From: fling Date: Mon, 1 Nov 2010 08:58:59 +0800 Subject: [PATCH] modified: ri_oper.py add signal pipe --- interface/ri_oper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/ri_oper.py b/interface/ri_oper.py index c6f8666..770739a 100644 --- a/interface/ri_oper.py +++ b/interface/ri_oper.py @@ -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):