[Pkg-privacy-commits] [onionshare] 137/256: Don't use shell=true in subprocess, and instead hide the console window in Windows using the startupinfo arg

Ulrike Uhlig ulrike at moszumanska.debian.org
Fri May 26 12:53:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

ulrike pushed a commit to branch master
in repository onionshare.

commit 0ddcda15701912b399ecf7bbc4380ed4e6fdf8a3
Author: Micah Lee <micah at micahflee.com>
Date:   Sat Apr 15 11:34:03 2017 -0700

    Don't use shell=true in subprocess, and instead hide the console window in Windows using the startupinfo arg
---
 onionshare/onion.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/onionshare/onion.py b/onionshare/onion.py
index 81e1dfd..d0908cb 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -176,9 +176,17 @@ class Onion(object):
             torrc_template = torrc_template.replace('{{socks_port}}',       str(self.tor_socks_port))
             open(self.tor_torrc, 'w').write(torrc_template)
 
-            # Open tor in a subprocess, wait for the controller to start
+            # Execute a tor subprocess
             start_ts = time.time()
-            self.tor_proc = subprocess.Popen([self.tor_path, '-f', self.tor_torrc], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+            if system == 'Windows':
+                # In Windows, hide console window when opening tor.exe subprocess
+                startupinfo = subprocess.STARTUPINFO()
+                startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+                self.tor_proc = subprocess.Popen([self.tor_path, '-f', self.tor_torrc], stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo)
+            else:
+                self.tor_proc = subprocess.Popen([self.tor_path, '-f', self.tor_torrc], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+            # Wait for the tor controller to start
             time.sleep(0.2)
 
             # Connect to the controller

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git



More information about the Pkg-privacy-commits mailing list