[node-patches] Change in ovirt-node[master]: Catch CTRL+C and don't exit

rbarry at redhat.com rbarry at redhat.com
Thu May 22 15:07:06 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Catch CTRL+C and don't exit
......................................................................

Catch CTRL+C and don't exit

Previous behavior was to keep the TUI running when CTRL+C was
pressed. Reintroduce that behavior.

Change-Id: I2803b010165996ea17a7da69e60e7c82cf218243
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1065848
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/app.py
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/21/28021/1

diff --git a/src/ovirt/node/app.py b/src/ovirt/node/app.py
index 788bfc9..8e0add4 100644
--- a/src/ovirt/node/app.py
+++ b/src/ovirt/node/app.py
@@ -23,6 +23,7 @@
 from ovirt.node.config import defaults
 from ovirt.node.ui import urwid_builder
 from ovirt.node.utils import system, Timer, console
+import signal
 import sys
 
 """
@@ -286,7 +287,11 @@
                                   "configure/install.")
                 import sys
                 sys.exit(0)
+            def _handler(signum, frame):
+                self.logger.debug("CTRL+C pressed")
+            signal.signal(signal.SIGINT, _handler)
             self.ui.run()
+
         except Exception as e:
             console.reset()
             self.logger.error("An error appeared in the UI: %s" % repr(e))


-- 
To view, visit http://gerrit.ovirt.org/28021
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2803b010165996ea17a7da69e60e7c82cf218243
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list