def spawn(self, command, cwd, env):
"""Starts the process
Spawn a new process and register the listeners on it
Arguments:
command {list} -- command list for the process (ex: ['ls', '-la'])
"""
child_env = os.environ.copy()
child_env.update(env if env is not None else {})
child_env.update({
"TERM":"sublimeterm",
"COLUMNS":"40",
"INPUTRC":"$(pwd)/inputrc"
})
self.master, self.slave = os.openpty()
self.process = subprocess.Popen(command,
stdin=self.slave,
stdout=self.slave,
stderr=self.slave,
preexec_fn=os.setsid,
cwd=cwd,
env=child_env)
评论列表
文章目录