[gnome-shell] When using -g, reset terminal state on exit



commit b153e4ed0f384bad90d5ceb84ba5652133251554
Author: Dan Winship <danw gnome org>
Date:   Mon Apr 13 11:58:05 2009 -0400

    When using -g, reset terminal state on exit
    
    Fixes various problems where gnome-shell would kill gdb and then leave
    the terminal in a broken state.
---
 src/gnome-shell.in |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/gnome-shell.in b/src/gnome-shell.in
index ffbdeec..9ecb5d7 100755
--- a/src/gnome-shell.in
+++ b/src/gnome-shell.in
@@ -10,6 +10,7 @@ import signal
 import subprocess
 import sys
 import tempfile
+import termios
 import time
 import errno
 
@@ -248,6 +249,11 @@ else:
 if options.verbose:
     print "Starting shell"
 
+if options.debug:
+    # Record initial terminal state so we can reset it to that
+    # later, in case we kill gdb at a bad time
+    termattrs = termios.tcgetattr(0);
+
 try:
     if run_in_xephyr:
         shell = start_xephyr()
@@ -274,6 +280,9 @@ except KeyboardInterrupt, e:
         print "Shell killed"
 
 finally:
+    if options.debug:
+        termios.tcsetattr(0, termios.TCSANOW, termattrs);
+
     if not run_in_xephyr:
         # Restart gnome-panel and window manager
         if metacity_pid:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]