def zsh(env, args, kwargs): """[STRING, ...]@Open a ZSH shell. If STRINGs specified, evaluates strings in ZSH.""" if args == []: os.environ["PATH"] = env.PATH os.system("zsh") else: return [run_command(env, 'zsh -c "' + x + '"') for x in args] return
def bash(env, args, kwargs): """[STRING,...]@Open a Bash shell. If STRINGs specified, evaluate strings in Bash.""" parsed_env = " ".join( ["env %s=%s" % (k, env.namespace[k]) for k in env.namespace]) if args == []: os.environ["PATH"] = env.PATH os.system(parsed_env + " bash") else: return [ item for sublist in [ run_command(env, x).split("\n") for x in [parsed_env + " " + x for x in args] ] for item in sublist ] return ""
def run_bash(env, stdin, pipe): try: pipe.setstack_args(run_command(env, stdin).split("\n")) return pipe.getstack_args(-1) except OSError: pass