mirror of https://github.com/mamba-org/mamba.git
Consider `SHELL` env var (#3997)
This commit is contained in:
parent
b3d580e610
commit
e39196dc20
|
@ -97,6 +97,14 @@ namespace mamba
|
|||
{
|
||||
return "fish";
|
||||
}
|
||||
|
||||
// Get `SHELL` environment variable if set
|
||||
// Standard values are assumed to be `/bin/{shell_type}` or `/usr/bin/{shell_type}`
|
||||
if (util::get_env("SHELL").has_value())
|
||||
{
|
||||
return util::split(util::get_env("SHELL").value(), "/").back();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -460,6 +460,10 @@ namespace
|
|||
std::vector<std::string> v21 = { "conda-forge/linux64:", "xtensor==0.12.3" };
|
||||
|
||||
REQUIRE(rsplit("conda-forge/linux64::xtensor==0.12.3", ":", 1) == v21);
|
||||
|
||||
std::vector<std::string> es3 = { "" };
|
||||
REQUIRE(split(es3[0], ".") == es3);
|
||||
REQUIRE(rsplit(es3[0], ".") == es3);
|
||||
}
|
||||
|
||||
TEST_CASE("join")
|
||||
|
|
|
@ -225,6 +225,14 @@ def test_init(tmp_home, tmp_root_prefix, shell_type, prefix_selector, multiple_t
|
|||
assert (tmp_root_prefix / "condabin").is_dir()
|
||||
|
||||
|
||||
def test_shell_init_with_env_var(tmp_home, tmp_root_prefix):
|
||||
skip_if_shell_incompat("bash")
|
||||
umamba_cmd = helpers.get_umamba()
|
||||
res = helpers.umamba_run("sh", "-c", f"export SHELL=/bin/bash; {umamba_cmd} shell init")
|
||||
assert res
|
||||
assert (tmp_root_prefix / "etc" / "profile.d").is_dir()
|
||||
|
||||
|
||||
def test_dash(tmp_home, tmp_root_prefix):
|
||||
skip_if_shell_incompat("dash")
|
||||
umamba = helpers.get_umamba()
|
||||
|
|
Loading…
Reference in New Issue