summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client.py26
-rw-r--r--src/gui.py1
2 files changed, 20 insertions, 7 deletions
diff --git a/src/client.py b/src/client.py
index a4249f9e..ddb2e901 100644
--- a/src/client.py
+++ b/src/client.py
@@ -24,14 +24,28 @@ from config import config
from handler import Handler
from gui import Gui
from curses import wrapper, initscr
+import curses
-sys.stderr = open('log', 'w')
+import signal
+signal.signal(signal.SIGINT, signal.SIG_IGN)
-if len(sys.argv) == 1: # not debug, so hide any error message and disable C-c
- import signal
- signal.signal(signal.SIGINT, signal.SIG_IGN)
- sys.stderr = open('/dev/null', 'w')
- sys.stdout = open('/dev/null', 'w')
+# disable any printout (this would mess the display)
+stderr = sys.stderr
+sys.stderr = open('/dev/null', 'w')
+sys.stdout = open('/dev/null', 'w')
+
+import traceback
+def exception_handler(type_, value, tb):
+ """
+ on any traceback: exit ncurses and print the traceback
+ then exit the program
+ """
+ curses.echo()
+ curses.endwin()
+ traceback.print_exception(type_, value, tb, None, stderr)
+ sys.exit()
+
+sys.excepthook = exception_handler
class Client(object):
"""
diff --git a/src/gui.py b/src/gui.py
index f476ec31..5520f1d1 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -154,7 +154,6 @@ class Gui(object):
self.init_curses(stdscr)
self.stdscr = stdscr
- self.stdscr.leaveok(1)
self.rooms = [Room('Info', '')] # current_room is self.rooms[0]
self.window = Window(stdscr)
self.window.text_win.new_win('Info')