diff --git a/scripts/deluge b/scripts/deluge index 962879d54..a0cab182d 100755 --- a/scripts/deluge +++ b/scripts/deluge @@ -37,6 +37,7 @@ import os from optparse import OptionParser import re +import subprocess import sys import deluge @@ -48,11 +49,6 @@ import deluge.pref if not deluge.common.windows_check(): import platform - i = 1 - arguments = "" - while i < len(sys.argv): - arguments = arguments + " " + sys.argv[i] - i+=1 if platform.system() == "Linux": # Add this, FreeBSD and other OSs than Linux do not have /etc/issue. print "checking for ubuntu..." if os.WEXITSTATUS(os.system('grep -iq "Ubuntu" /etc/issue')) == 0: @@ -60,7 +56,7 @@ if not deluge.common.windows_check(): print "found and fixing ubuntu" os.environ["MOZILLA_FIVE_HOME"] = "/usr/lib/firefox" os.environ["LD_LIBRARY_PATH"] = "/usr/lib/firefox" - os.system("/usr/bin/deluge %s &" % arguments) + subprocess.Popen(sys.argv) raise SystemExit parser = OptionParser(usage="%prog [options] [torrents to add]", @@ -136,12 +132,7 @@ try: bus = dbus.SessionBus() except: if not deluge.common.windows_check(): - while i < len(sys.argv): - arguments = arguments + " " + sys.argv[i] - i+=1 - pid = os.fork() - if not pid: - os.popen('dbus-launch deluge %s' %arguments) + subprocess.Popen(["dbus-launch", "deluge"] + sys.argv[1:]) else: dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames()