T16: a shell saves only when the running user may run it, as access answers, ACLs too, found at a full path or in one of PATH's full folders, never a relative one; a session runs that same full path, so the check and the start agree
This commit is contained in:
4 files changed
+87
-33
No files matched your search
+6
-1
@@ -77,7 +77,12 @@ pub fn launch(shell: &str, cwd: PathBuf, dir: &Path) -> anyhow::Result<Launch> {
|
||||
let path = if shell.is_empty() {
|
||||
default_shell()?
|
||||
} else {
|
||||
shell.to_string()
|
||||
// The settings checked this path; the session runs no other.
|
||||
let found = crate::settings::program_path(shell)
|
||||
.with_context(|| format!("shell integration: {shell:?} names no program"))?;
|
||||
(found.to_str())
|
||||
.with_context(|| format!("shell integration: {} is not UTF-8", found.display()))?
|
||||
.to_string()
|
||||
};
|
||||
let name = Path::new(&path)
|
||||
.file_stem()
|
||||
|
||||
@@ -247,6 +247,14 @@ fn powershell_reports_its_folder_byte_for_byte_and_keeps_the_status() {
|
||||
run.finish();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_shell_named_bare_runs_from_its_full_path() {
|
||||
let started = launch("sh", PathBuf::from("/"), Path::new("/nonexistent")).expect("a launch");
|
||||
let (program, _) = started.program.expect("a program");
|
||||
assert!(Path::new(&program).is_absolute(), "{program}");
|
||||
assert!(launch("no-such-shell", PathBuf::from("/"), Path::new("/")).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_unknown_shell_starts_without_integration() {
|
||||
let dir = PathBuf::from("/nonexistent");
|
||||
|
||||
Reference in new issue
Block a user