commit b0aa8fb070f6d28a7295cc528342ce32e4c5cf63 Author: Jiri Pirko jpirko@redhat.com Date: Fri Jul 1 17:38:51 2011 +0200
TestsCommon: set SIGINT handler only for bgprocess
Signed-off-by: Jiri Pirko jpirko@redhat.com
Common/TestsCommon.py | 8 +++++++- NetTest/NetTestCommand.py | 1 + 2 files changed, 8 insertions(+), 1 deletions(-) --- diff --git a/Common/TestsCommon.py b/Common/TestsCommon.py index 1e275ca..6d92667 100644 --- a/Common/TestsCommon.py +++ b/Common/TestsCommon.py @@ -57,13 +57,19 @@ class TestGeneric(NetTestCommandGeneric): def __init__(self, command): self._testLogger = logging.getLogger("root.testLogger") self._read_pipe, self._write_pipe = os.pipe() - signal.signal(signal.SIGINT, self._signal_intr_handler) NetTestCommandGeneric.__init__(self, command)
def __del__(self): os.close(self._read_pipe) os.close(self._write_pipe)
+ def set_handle_intr(self): + """ + Call this if you need this class to handle SIGINT. For backgroud + process purposes. + """ + signal.signal(signal.SIGINT, self._signal_intr_handler) + def _signal_intr_handler(self, signum, frame): os.write(self._write_pipe, "a")
diff --git a/NetTest/NetTestCommand.py b/NetTest/NetTestCommand.py index 1605401..031865a 100644 --- a/NetTest/NetTestCommand.py +++ b/NetTest/NetTestCommand.py @@ -184,6 +184,7 @@ class NetTestCommand: return {"passed": True} os.close(read_pipe) os.setpgrp() + cmd_cls.set_handle_intr() try: cmd_cls.run() result = cmd_cls.get_result()
lnst-developers@lists.fedorahosted.org