Skip to content

Commit

Permalink
Source bash files in non-interactive mode (conda#13012)
Browse files Browse the repository at this point in the history
Co-authored-by: Jannis Leidel <[email protected]>
  • Loading branch information
gforsyth and jezdez authored Sep 25, 2023
1 parent 2745211 commit 7a777b8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conda/activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ class XonshActivator(_Activator):
run_script_tmpl = (
'source-cmd --suppress-skip-message "%s"'
if on_win
else 'source-bash --suppress-skip-message "%s"'
else 'source-bash --suppress-skip-message -n "%s"'
)

hook_source_path = join(CONDA_PACKAGE_ROOT, "shell", "conda.xsh")
Expand Down
20 changes: 20 additions & 0 deletions news/13012-dont-source-interactive
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Enhancements

* <news item>

### Bug fixes

* ``XonshActivator`` now uses ``source-bash`` in non-interactive mode to avoid
side-effects from interactively loaded RC files

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
6 changes: 3 additions & 3 deletions tests/test_activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ def test_xonsh_basic(shell_wrapper_unit: str):
join(shell_wrapper_unit, "etc", "conda", "activate.d", "activate1.bat")
)
else:
e_activate_info["sourcer"] = "source-bash --suppress-skip-message"
e_activate_info["sourcer"] = "source-bash --suppress-skip-message -n"
e_activate_info["activate1"] = activator.path_conversion(
join(shell_wrapper_unit, "etc", "conda", "activate.d", "activate1.sh")
)
Expand Down Expand Up @@ -1786,7 +1786,7 @@ def test_xonsh_basic(shell_wrapper_unit: str):
)
)
else:
e_reactivate_info["sourcer"] = "source-bash --suppress-skip-message"
e_reactivate_info["sourcer"] = "source-bash --suppress-skip-message -n"
e_reactivate_info["activate1"] = activator.path_conversion(
join(shell_wrapper_unit, "etc", "conda", "activate.d", "activate1.sh")
)
Expand Down Expand Up @@ -1838,7 +1838,7 @@ def test_xonsh_basic(shell_wrapper_unit: str):
)
)
else:
e_deactivate_info["sourcer"] = "source-bash --suppress-skip-message"
e_deactivate_info["sourcer"] = "source-bash --suppress-skip-message -n"
e_deactivate_info["deactivate1"] = activator.path_conversion(
join(
shell_wrapper_unit, "etc", "conda", "deactivate.d", "deactivate1.sh"
Expand Down

0 comments on commit 7a777b8

Please sign in to comment.