gnome-shell/scripts/start-replace
Owen Taylor 0a2a65e810 Pass the right number of arguments to exit()
When using gdb to quit the panel, pass the right number of arguments
to exit(), so that gdb calls it instead of erroring out.

svn path=/trunk/; revision=22
2008-11-02 04:18:36 +00:00

37 lines
981 B
Python
Executable File

#!/usr/bin/python
import os
import subprocess
import signal
from launcher import Launcher
launcher = Launcher()
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()",
"-ex", "call exit(0)",
"-p", pid], stdout=devnull, stderr=devnull)
devnull.close()
shell = launcher.start_shell()
# Wait for shell to exit
try:
shell.wait()
except KeyboardInterrupt, e:
os.kill(shell.pid, signal.SIGKILL)
shell.wait()
finally:
# Restart gnome-panel and window manager
subprocess.Popen(["/usr/bin/metacity"])
subprocess.Popen(["/usr/bin/gnome-panel"])