aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/cmd
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-07-12 18:04:03 -0700
committerRoss Brattain <ross.b.brattain@intel.com>2017-07-12 18:10:26 -0700
commit4eca49e30eb08becae65377bba8aa244a78c3eb5 (patch)
tree0948abb4bb4f57f705e774b9279f77ce10201cf0 /yardstick/cmd
parent29484c3071028df6c897797706117082a4b8c3f5 (diff)
NSBperf: fix bad sigint handler
This is why we don't do things at module import time. when we import this module it makes a bad sigint handler. Only load signal handlers at runtime. Also fix handler to take *args, **kwargs. Unittest failures: > time.sleep(0.01) E TypeError: handler() takes 0 positional arguments but 2 were given Change-Id: I4296a4bdef0e5f4d58b0503dcbc834f3bef0feeb Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'yardstick/cmd')
-rwxr-xr-xyardstick/cmd/NSBperf.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/yardstick/cmd/NSBperf.py b/yardstick/cmd/NSBperf.py
index f158d57f4..011990a3d 100755
--- a/yardstick/cmd/NSBperf.py
+++ b/yardstick/cmd/NSBperf.py
@@ -39,13 +39,11 @@ if not PYTHONPATH or not VIRTUAL_ENV:
raise SystemExit(1)
-def handler():
+def sigint_handler(*args, **kwargs):
""" Capture ctrl+c and exit cli """
subprocess.call(["pkill", "-9", "yardstick"])
raise SystemExit(1)
-signal.signal(signal.SIGINT, handler)
-
class YardstickNSCli(object):
""" This class handles yardstick network serivce testing """
@@ -214,5 +212,6 @@ class YardstickNSCli(object):
self.run_test(args, test_path)
if __name__ == "__main__":
+ signal.signal(signal.SIGINT, sigint_handler)
NS_CLI = YardstickNSCli()
NS_CLI.main()