[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [chutney/master] Ticket 33304 - Return None for pid when pid file is empty



commit 185852f602ccd9168d7b7d5d13ad060feaa7a57d
Author: Steven Engler <sengler@xxxxxxxxxxxx>
Date:   Wed Feb 12 23:59:47 2020 -0500

    Ticket 33304 - Return None for pid when pid file is empty
---
 lib/chutney/TorNet.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 47b8e84..6f4041a 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -863,7 +863,10 @@ class LocalNodeController(NodeController):
             return None
 
         with open(pidfile, 'r') as f:
-            return int(f.read())
+            try:
+                return int(f.read())
+            except ValueError:
+                return None
 
     def isRunning(self, pid=None):
         """Return true iff this node is running.  (If 'pid' is provided, we



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits