added taskkill hack for killing onionr's Tor process on Windows

This commit is contained in:
KF 2019-08-27 21:15:56 -05:00
parent 03356e98fd
commit 7d2080a1d1

View File

@ -18,6 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
''' '''
import os, sys, base64, subprocess, signal, time import os, sys, base64, subprocess, signal, time
import platform # For windows sigkill workaround
import config, logger import config, logger
from . import getopenport from . import getopenport
from utils import identifyhome from utils import identifyhome
@ -184,6 +185,11 @@ HiddenServicePort 80 ''' + self.apiServerIP + ''':''' + str(self.hsPort)
except FileNotFoundError: except FileNotFoundError:
pass pass
time.sleep(TOR_KILL_WAIT) time.sleep(TOR_KILL_WAIT)
if 'windows' == platform.system().lower():
os.system('taskkill /PID %s /F' % (pidN,))
time.sleep(0.5)
return
try: try:
os.kill(int(pidN), signal.SIGKILL) os.kill(int(pidN), signal.SIGKILL)
except (ProcessLookupError, PermissionError) as e: except (ProcessLookupError, PermissionError) as e: