Author: andar
Revision: 5731
Log:
Do not fail to start if deluged.pid contains no data
Diff:
Modified: trunk/deluge/core/daemon.py
===================================================================
--- trunk/deluge/core/daemon.py 2009-09-13 15:33:45 UTC (rev 5730)
+++ trunk/deluge/core/daemon.py 2009-09-13 17:17:37 UTC (rev 5731)
@@ -51,10 +51,15 @@
# Check for another running instance of the daemon
if os.path.isfile(deluge.configmanager.get_config_dir("deluged.pid")):
# Get the PID and the port of the supposedly running daemon
- (pid, port) =
open(deluge.configmanager.get_config_dir("deluged.pid")).read().strip().split(";")
- pid = int(pid)
- port = int(port)
+ try:
+ (pid, port) =
open(deluge.configmanager.get_config_dir("deluged.pid")).read().strip().split(";")
+ pid = int(pid)
+ port = int(port)
+ except ValueError:
+ pid = None
+ port = None
+
def process_running(pid):
if deluge.common.windows_check():
# Do some fancy WMI junk to see if the PID exists in
Windows
@@ -73,7 +78,7 @@
else:
return True
- if process_running(pid):
+ if pid is not None and process_running(pid):
# Ok, so a process is running with this PID, let's make
doubly-sure
# it's a deluged process by trying to open a socket to it's
port.
import socket
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---