]> Dogcows Code - chaz/openbox/commitdiff
make xdg-autostart check for PyXDG and print a better error than a backtrace. and...
authorDana Jansens <danakj@orodu.net>
Sat, 9 Feb 2008 23:26:15 +0000 (18:26 -0500)
committerDana Jansens <danakj@orodu.net>
Sun, 10 Feb 2008 00:02:08 +0000 (19:02 -0500)
tools/xdg-autostart/xdg-autostart

index 6cee134209e6d4190325670b8eb84567eabd39da..daa9117d5213f6fc24016a80bebed0e9fe87ded4 100755 (executable)
 ME="xdg-autostart"
 VERSION="1.0"
 
-from xdg import BaseDirectory
-from xdg.DesktopEntry import DesktopEntry
-from xdg.Exceptions import ParsingError
 import os, glob, sys
+try:
+    from xdg import BaseDirectory
+    from xdg.DesktopEntry import DesktopEntry
+    from xdg.Exceptions import ParsingError
+except ImportError:
+    print
+    print "ERROR:", ME, "requires PyXDG to be installed"
+    print
+    sys.exit(1)
 
 def main(argv=sys.argv):
     if "--help" in argv[1:]:
@@ -154,8 +160,8 @@ class AutostartFile():
         if self.de.getPath():
             os.chdir(self.de.getPath())
         if self.shouldRun(envs):
-            print "Running autostart file: " + self.path
-            os.system(self.de.getExec());
+            args = ["/bin/sh", "-c", "exec " + self.de.getExec()]
+            os.spawnv(os.P_NOWAIT, args[0], args);
         os.chdir(here)
 
 def show_help():
This page took 0.02663 seconds and 4 git commands to generate.