def fork_bash(env, cwd): # bash is a special little snowflake, and prevent_path_errors cannot work there # https://github.com/berdario/pew/issues/58#issuecomment-102182346 bashrcpath = expandpath("~/.bashrc") if bashrcpath.exists(): with NamedTemporaryFile("w+") as rcfile: with bashrcpath.open() as bashrc: rcfile.write(bashrc.read()) rcfile.write('\nexport PATH="' + to_unicode(compute_path(env)) + '"') rcfile.flush() fork_shell(env, ["bash", "--rcfile", rcfile.name], cwd) else: fork_shell(env, ["bash"], cwd)
def fork_bash(env, cwd): # bash is a special little snowflake, and prevent_path_errors cannot work there # https://github.com/berdario/pew/issues/58#issuecomment-102182346 bashrcpath = expandpath('~/.bashrc') if bashrcpath.exists(): with NamedTemporaryFile('w+') as rcfile: with bashrcpath.open() as bashrc: rcfile.write(bashrc.read()) rcfile.write('\nexport PATH="' + to_unicode(compute_path(env)) + '"') rcfile.flush() fork_shell(env, ['bash', '--rcfile', rcfile.name], cwd) else: fork_shell(env, ['bash'], cwd)