2008-11-01 15:45:00 -04:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2008-11-01 19:55:49 -04:00
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import signal
|
2008-11-01 15:45:00 -04:00
|
|
|
|
2008-11-01 19:55:49 -04:00
|
|
|
from launcher import Launcher
|
|
|
|
|
|
|
|
launcher = Launcher()
|
2008-11-01 15:45:00 -04:00
|
|
|
|
|
|
|
try:
|
|
|
|
# Kill gnome-panel in a way that it won't autorespawn
|
|
|
|
pidof = subprocess.Popen(["/sbin/pidof", "gnome-panel"], stdout=subprocess.PIPE)
|
|
|
|
pids = pidof.communicate()[0].split()
|
|
|
|
pidof.wait()
|
|
|
|
devnull = open("/dev/null", "w")
|
|
|
|
for pid in pids:
|
|
|
|
subprocess.call(["gdb", "-batch-silent",
|
|
|
|
"-ex", "call panel_session_do_not_restart()",
|
2008-11-02 00:18:36 -04:00
|
|
|
"-ex", "call exit(0)",
|
2008-11-01 15:45:00 -04:00
|
|
|
"-p", pid], stdout=devnull, stderr=devnull)
|
|
|
|
devnull.close()
|
|
|
|
|
2008-11-01 19:55:49 -04:00
|
|
|
shell = launcher.start_shell()
|
2008-11-01 15:45:00 -04:00
|
|
|
|
2008-11-01 19:55:49 -04:00
|
|
|
# Wait for shell to exit
|
2008-11-01 15:45:00 -04:00
|
|
|
try:
|
2008-11-01 19:55:49 -04:00
|
|
|
shell.wait()
|
2008-11-01 15:45:00 -04:00
|
|
|
except KeyboardInterrupt, e:
|
2008-11-01 19:55:49 -04:00
|
|
|
os.kill(shell.pid, signal.SIGKILL)
|
|
|
|
shell.wait()
|
2008-11-01 15:45:00 -04:00
|
|
|
finally:
|
|
|
|
# Restart gnome-panel and window manager
|
|
|
|
|
|
|
|
subprocess.Popen(["/usr/bin/metacity"])
|
|
|
|
subprocess.Popen(["/usr/bin/gnome-panel"])
|