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

[tor-commits] [stem/master] Checking for windows style execs in is_available



commit 35f31d8c1527e106013ceb293302901dce8f9cf0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Apr 6 09:26:50 2012 -0700

    Checking for windows style execs in is_available
    
    Stem tries to check that a command is available prior to running it, which
    choked on Windows due to the '.exe' extension. Issue caught by reganeet and
    fix suggested by him.
---
 stem/util/system.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/stem/util/system.py b/stem/util/system.py
index 1a85dc8..f8f128a 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -18,6 +18,7 @@ call - runs the given system command and provides back the results
 
 import os
 import time
+import platform
 import subprocess
 
 import stem.util.proc
@@ -78,6 +79,7 @@ def is_available(command, cached=True):
     cmd_exists = False
     for path in os.environ["PATH"].split(os.pathsep):
       cmd_path = os.path.join(path, command)
+      if platform.system() == "Windows": cmd_path += ".exe"
       
       if os.path.exists(cmd_path) and os.access(cmd_path, os.X_OK):
         cmd_exists = True

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