[tor-commits] [arm/release] Fetching pid with 'GETINFO process/pid' if able

atagar at torproject.org atagar at torproject.org
Sun Jul 17 06:08:16 UTC 2011


commit a1271d49f14f8d63e983043e677c92ba15fa9c9b
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Apr 22 19:12:34 2011 -0700

    Fetching pid with 'GETINFO process/pid' if able
    
    This is a new controller option added in ticket 2291
    (https://trac.torproject.org/projects/tor/ticket/2291). This was tested against
    Tor v0.2.3.0-alpha-dev by making sure we're making the getinfo call, and not
    using pgrep to resolve the pid.
---
 src/util/torTools.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index 3ef66f2..5e77f2e 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -1692,7 +1692,10 @@ class Controller(TorCtl.PostEventListener):
       elif key == "parsedVersion":
         result = parseVersion(self.getInfo("version", ""))
       elif key == "pid":
-        result = getPid(int(self.getOption("ControlPort", 9051)), self.getOption("PidFile"))
+        result = self.getInfo("process/pid")
+        
+        if not result:
+          result = getPid(int(self.getOption("ControlPort", 9051)), self.getOption("PidFile"))
       elif key == "user":
         # This was added in Tor 0.2.3.x-final so it's quite likely unavailable.
         # Even if it is, it might fail and return an empty string.





More information about the tor-commits mailing list