Hi,
Hope this is the right ml this time. ;)
Added a few lines of code that handles the situation somewhat cleaner if a user presses ctrl-c while namcap is running.
Best regards, Alexander Rødseth
--- namcap.py | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/namcap.py b/namcap.py index cca5dd6..f26cdf7 100755 --- a/namcap.py +++ b/namcap.py @@ -19,6 +19,25 @@ # #
+# Try to catch ctrl-c in a cleaner way +try: + import signal + def signal_handler(signal, frame): + print("\nInterrupted") + try: + sys.exit(2) + except NameError: + import sys + sys.exit(2) + signal.signal(signal.SIGINT, signal_handler) +except KeyboardInterrupt: + print("\nInterrupted") + try: + sys.exit(1) + except NameError: + import sys + sys.exit(1) + import getopt import imp import os
On Friday 09 December 2011 12:46:24 Alexander =?ISO-8859-1?Q?R=F8dseth?= wrote:
Hi,
Hope this is the right ml this time. ;)
Added a few lines of code that handles the situation somewhat cleaner if a user presses ctrl-c while namcap is running.
*please* stop spam /jk
arch-projects@lists.archlinux.org