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

[tor-commits] [chutney/master] TorNet: Avoid corefile name errors



commit 2dabf64354fa6f6ce26233fe00f92f1d2a097360
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Thu Feb 13 16:56:44 2020 +1000

    TorNet: Avoid corefile name errors
    
    Stop using None pids to make corefile names when checking if tor
    has crashed.
    
    Cleanup after 33304.
---
 lib/chutney/TorNet.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 6f4041a..6dbda36 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -900,7 +900,9 @@ class LocalNodeController(NodeController):
         pid = self.getPid()
         nick = self._env['nick']
         datadir = self._env['dir']
-        corefile = "core.%s" % pid
+        corefile = None
+        if pid:
+            corefile = "core.%d" % pid
         tor_version = get_tor_version(self._env['tor'])
         if self.isRunning(pid):
             if listRunning:
@@ -908,7 +910,7 @@ class LocalNodeController(NodeController):
                 print("{:12} is running with PID {:5}: {}"
                       .format(nick, pid, tor_version))
             return True
-        elif os.path.exists(os.path.join(datadir, corefile)):
+        elif corefile and os.path.exists(os.path.join(datadir, corefile)):
             if listNonRunning:
                 print("{:12} seems to have crashed, and left core file {}: {}"
                       .format(nick, corefile, tor_version))

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