Skip to content

Instantly share code, notes, and snippets.

@cas--
Created November 26, 2012 19:07
Show Gist options
  • Save cas--/4149972 to your computer and use it in GitHub Desktop.
Save cas--/4149972 to your computer and use it in GitHub Desktop.
commit 91c0e687c768ea4189849fce6a0dedcff4d55572
Author: Calum Lind <[email protected]>
Date: Mon Nov 26 19:07:12 2012 +0000
Change start_daemon to use subprocess.Popen cross-platform
diff --git a/deluge/ui/client.py b/deluge/ui/client.py
index ada16d4..bd7e880 100644
--- a/deluge/ui/client.py
+++ b/deluge/ui/client.py
@@ -41,16 +41,12 @@
import deluge.rencode as rencode
import zlib
+import subprocess
import deluge.common
import deluge.component as component
from deluge.log import LOG as log
-if deluge.common.windows_check():
- import win32api
-else:
- import subprocess
-
RPC_RESPONSE = 1
RPC_ERROR = 2
RPC_EVENT = 3
@@ -578,12 +574,7 @@ def start_daemon(self, port, config):
"""
try:
- if deluge.common.windows_check():
- win32api.WinExec("deluged --port=%s --config=\"%s\"" % (port, config))
- elif deluge.common.osx_check():
- subprocess.call(["nohup", "deluged", "--port=%s" % port, "--config=%s" % config])
- else:
- subprocess.call(["deluged", "--port=%s" % port, "--config=%s" % config])
+ subprocess.Popen(["deluged", "--port=%s" % port, "--config=%s" % config])
except OSError, e:
from errno import ENOENT
if e.errno == ENOENT:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment