|
|
@ -313,6 +313,8 @@ class Stream(mitogen.core.Stream):
|
|
|
|
if remote_name is None:
|
|
|
|
if remote_name is None:
|
|
|
|
remote_name = '%s@%s:%d'
|
|
|
|
remote_name = '%s@%s:%d'
|
|
|
|
remote_name %= (getpass.getuser(), socket.gethostname(), os.getpid())
|
|
|
|
remote_name %= (getpass.getuser(), socket.gethostname(), os.getpid())
|
|
|
|
|
|
|
|
if '/' in remote_name or '\\' in remote_name:
|
|
|
|
|
|
|
|
raise ValueError('remote_name= cannot contain slashes')
|
|
|
|
self.remote_name = remote_name
|
|
|
|
self.remote_name = remote_name
|
|
|
|
self.debug = debug
|
|
|
|
self.debug = debug
|
|
|
|
self.profiling = profiling
|
|
|
|
self.profiling = profiling
|
|
|
@ -332,9 +334,11 @@ class Stream(mitogen.core.Stream):
|
|
|
|
# Minimised, gzipped, base64'd and passed to 'python -c'. It forks, dups
|
|
|
|
# Minimised, gzipped, base64'd and passed to 'python -c'. It forks, dups
|
|
|
|
# file descriptor 0 as 100, creates a pipe, then execs a new interpreter
|
|
|
|
# file descriptor 0 as 100, creates a pipe, then execs a new interpreter
|
|
|
|
# with a custom argv.
|
|
|
|
# with a custom argv.
|
|
|
|
# 'CONTEXT_NAME', 'PREAMBLE_COMPRESSED_LEN', and 'PREAMBLE_LEN' are
|
|
|
|
# * Optimized for minimum byte count after minification & compression.
|
|
|
|
|
|
|
|
# * 'CONTEXT_NAME', 'PREAMBLE_COMPRESSED_LEN', and 'PREAMBLE_LEN' are
|
|
|
|
# substituted with their respective values.
|
|
|
|
# substituted with their respective values.
|
|
|
|
# Optimized for minimum byte count after minification & compression.
|
|
|
|
# * CONTEXT_NAME must be prefixed with the name of the Python binary in
|
|
|
|
|
|
|
|
# order to allow virtualenvs to detect their install prefix.
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def _first_stage():
|
|
|
|
def _first_stage():
|
|
|
|
R,W=os.pipe()
|
|
|
|
R,W=os.pipe()
|
|
|
@ -348,7 +352,7 @@ class Stream(mitogen.core.Stream):
|
|
|
|
os.close(W)
|
|
|
|
os.close(W)
|
|
|
|
os.close(w)
|
|
|
|
os.close(w)
|
|
|
|
os.environ['ARGV0']=sys.executable
|
|
|
|
os.environ['ARGV0']=sys.executable
|
|
|
|
os.execl(sys.executable,'mitogen:CONTEXT_NAME')
|
|
|
|
os.execl(sys.executable,sys.executable+'(mitogen:CONTEXT_NAME)')
|
|
|
|
os.write(1,'EC0\n')
|
|
|
|
os.write(1,'EC0\n')
|
|
|
|
C=_(os.fdopen(0,'rb').read(PREAMBLE_COMPRESSED_LEN),'zip')
|
|
|
|
C=_(os.fdopen(0,'rb').read(PREAMBLE_COMPRESSED_LEN),'zip')
|
|
|
|
os.fdopen(W,'w',0).write(C)
|
|
|
|
os.fdopen(W,'w',0).write(C)
|
|
|
|