This commit is contained in:
Kovid Goyal 2012-04-02 17:59:01 +05:30
parent 09122265fd
commit e3873e4254
2 changed files with 4 additions and 3 deletions

View File

@ -167,7 +167,8 @@ class Worker(object):
''' '''
exe = self.gui_executable if self.gui else self.executable exe = self.gui_executable if self.gui else self.executable
env = self.env env = self.env
env['ORIGWD'] = cwd or os.path.abspath(os.getcwd()) env[b'ORIGWD'] = binascii.hexlify(cPickle.dumps(cwd or
os.path.abspath(os.getcwdu())))
_cwd = cwd _cwd = cwd
if priority is None: if priority is None:
priority = prefs['worker_process_priority'] priority = prefs['worker_process_priority']

View File

@ -5,7 +5,7 @@ __license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import sys, cPickle, os import sys, cPickle, os, binascii
from code import InteractiveInterpreter from code import InteractiveInterpreter
from Queue import Queue, Empty from Queue import Queue, Empty
from threading import Thread from threading import Thread
@ -130,7 +130,7 @@ class Interpreter(InteractiveInterpreter): # {{{
# }}} # }}}
def connect(): def connect():
os.chdir(os.environ['ORIGWD']) os.chdir(cPickle.loads(binascii.unhexlify(os.environ['ORIGWD'])))
address = cPickle.loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS'])) address = cPickle.loads(unhexlify(os.environ['CALIBRE_WORKER_ADDRESS']))
key = unhexlify(os.environ['CALIBRE_WORKER_KEY']) key = unhexlify(os.environ['CALIBRE_WORKER_KEY'])
return Client(address, authkey=key) return Client(address, authkey=key)