gnome-shell/scripts/start-replace
Owen Taylor e81ed61a38 Add --debug and --verbose options to launcher scripts
Factor out a common Launcher class from start-in-Xepyhr and
start-replace that handles option parsing and launching gnome-shell,
and add options:

 -v/--verbose: Unless specified, suppress most gjs debug output
 -g/--debug: If specified run under gdb
 --debug-command: Run under some other debugging (strace/valgrind/etc.)
     Implies -g

svn path=/trunk/; revision=18
2008-11-01 23:55:49 +00:00

37 lines
980 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()",
"-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"])