Skip to content

Commit

Permalink
Nested shells should not be login (#5247) (#5565)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlukes committed Jul 1, 2020
1 parent 94af525 commit b152dd3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions notebook/terminal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ def initialize(nb_app):
shell = nb_app.terminado_settings.get('shell_command',
[os.environ.get('SHELL') or default_shell]
)
# Enable login mode - to automatically source the /etc/profile script
if os.name != 'nt':
# Enable login mode - to automatically source the /etc/profile
# script, but only for non-nested shells; for nested shells, it's
# superfluous and may even be harmful (e.g. on macOS, where login
# shells invoke /usr/libexec/path_helper to add entries from
# /etc/paths{,.d} to the PATH, reordering it in the process and
# potentially overriding virtualenvs and other PATH modifications)
if os.name != 'nt' and int(os.environ.get("SHLVL", 0)) < 1:
shell.append('-l')
terminal_manager = nb_app.web_app.settings['terminal_manager'] = TerminalManager(
shell_command=shell,
Expand Down

0 comments on commit b152dd3

Please sign in to comment.