summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xportato.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/portato.py b/portato.py
index 646e850..1c73f74 100755
--- a/portato.py
+++ b/portato.py
@@ -15,8 +15,7 @@
from portato import listener
from portato.constants import VERSION, FRONTENDS, STD_FRONTEND, XSD_LOCATION, LOCALE_DIR, APP, SU_COMMAND
from optparse import OptionParser
-from subprocess import call
-import sys, os, socket
+import sys, os
import gettext, locale
def get_frontend_list ():
@@ -88,26 +87,23 @@ def main ():
else:
print _("Validation succeeded.")
return
- elif options.nolistener:
+ elif options.nolistener or os.getuid() == 0:
listener.set_send()
run()
else: # start listener and start us again in root modus
- if os.fork() == 0:
- listener.set_recv()
- else:
+ pid = os.fork()
+ if pid == 0: # start portato in child
additional = []
if options.check:
additional.append("-c")
if options.frontend:
additional.extend(["-f", options.frontend])
- try:
- if os.getuid() != 0:
- call(SU_COMMAND.split()+["%s --no-listener %s" % (sys.argv[0], " ".join(additional))], env = os.environ)
- else:
- call([sys.argv[0], "--no-listener"]+additional, env = os.environ)
- except KeyboardInterrupt:
- pass
+ cmd = SU_COMMAND.split()
+ os.execvpe(cmd[0], cmd+["%s --no-listener %s" % (sys.argv[0], " ".join(additional))], env = os.environ)
+
+ else: # start listener
+ listener.set_recv()
if __name__ == "__main__":
main()
+68 2008-06-23Added plugin, which simply throws an exceptionRené 'Necoro' Neumann2-0/+15 2008-06-23Fixed name of gpytage pluginRené 'Necoro' Neumann1-1/+1 2008-06-23Moved GtkThread to gui.utilsRené 'Necoro' Neumann5-29/+25 2008-06-22Implemented the mail sendingRené 'Necoro' Neumann2-3/+63 2008-06-22First mail window draftRené 'Necoro' Neumann3-0/+220 2008-06-10Added gpytage pluginRené 'Necoro' Neumann2-0/+29 2008-06-10Modified plugin.xsd so it allows also menu-only pluginsRené 'Necoro' Neumann2-7/+8 2008-06-10Fixed the default handlingRené 'Necoro' Neumann1-1/+1 2008-06-10Allowed default for session; load 'app-portage/portato' as default for select...René 'Necoro' Neumann2-10/+18 2008-06-09Fixed 'kill' in the systray popupRené 'Necoro' Neumann1-2/+2 2008-06-09Fixed error messageRené 'Necoro' Neumann2-4/+1 2008-06-08Make blocks way more intelligentRené 'Necoro' Neumann3-45/+107