start_new_session=True

This commit is contained in:
j 2016-01-02 22:33:49 +05:30
parent 9b2c76e464
commit 5feb82a080

View file

@ -12,6 +12,7 @@ import utils
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
logging.getLogger('stem').setLevel(logging.ERROR)
class TorDaemon(Thread): class TorDaemon(Thread):
def __init__(self): def __init__(self):
@ -72,8 +73,8 @@ DirReqStatistics 0
self._status.append('No tor binary found. Please install TorBrowser or tor') self._status.append('No tor binary found. Please install TorBrowser or tor')
else: else:
cmd = [tor, '--defaults-torrc', defaults, '-f', torrc] cmd = [tor, '--defaults-torrc', defaults, '-f', torrc]
self.p = subprocess.Popen(cmd, self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1,
stdout=subprocess.PIPE, bufsize=1, universal_newlines=True, close_fds=True) universal_newlines=True, close_fds=True, start_new_session=True)
for line in self.p.stdout: for line in self.p.stdout:
self._status.append(line) self._status.append(line)
logger.debug(line) logger.debug(line)
@ -153,7 +154,7 @@ class Tor(object):
def shutdown(self): def shutdown(self):
self._shutdown = True self._shutdown = True
try: try:
#self.unpublish() self.depublish()
if self.controller: if self.controller:
#self.controller.remove_event_listener(self.connection_change) #self.controller.remove_event_listener(self.connection_change)
self.controller.close() self.controller.close()
@ -188,7 +189,7 @@ class Tor(object):
settings.USER_ID, settings.server_defaults['node_port']) settings.USER_ID, settings.server_defaults['node_port'])
''' '''
def unpublish(self): def depublish(self):
if not self.connected: if not self.connected:
return False return False
if self.controller: if self.controller: