mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-26 15:59:48 -05:00
Don't use shell=true in subprocess, and instead hide the console window in Windows using the startupinfo arg
This commit is contained in:
parent
5a18b33aa4
commit
0ddcda1570
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user