Skip to content

Commit e2c6cc7

Browse files
committed
fix(supervisor): make startup snippet test portable
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent f047410 commit e2c6cc7

2 files changed

Lines changed: 11 additions & 16 deletions

File tree

‎crates/openshell-supervisor-process/src/child_env.rs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,13 @@ mod tests {
443443
#[test]
444444
fn startup_snippets_are_idempotent() {
445445
let dir = tempfile::tempdir().expect("tempdir");
446-
let profile_path = dir.path().join("etc/profile.d/openshell-path.sh");
447-
let home = dir.path().join("sandbox");
446+
// macOS commonly exposes its temporary directory through `/var`, a
447+
// symlink to `/private/var`. Use the canonical directory because the
448+
// startup-file writer deliberately refuses to traverse symlinked
449+
// ancestors.
450+
let root = dir.path().canonicalize().expect("canonical tempdir");
451+
let profile_path = root.join("etc/profile.d/openshell-path.sh");
452+
let home = root.join("sandbox");
448453
std::fs::create_dir_all(&home).expect("home dir");
449454
let bashrc_path = home.join(".bashrc");
450455
std::fs::write(

‎crates/openshell-supervisor-process/src/ssh.rs‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,13 +1492,8 @@ fn spawn_pipe_exec(
14921492
// reads commands line-by-line (script mode), which is what VS Code expects.
14931493
let shell = openshell_core::shell::detect_login_shell();
14941494
let repair_standard_sbin = child_env::standard_sbin_path_repair_enabled(policy);
1495-
let mut cmd = build_ssh_shell_command(
1496-
&shell,
1497-
command,
1498-
no_login_shell,
1499-
None,
1500-
repair_standard_sbin,
1501-
);
1495+
let mut cmd =
1496+
build_ssh_shell_command(&shell, command, no_login_shell, None, repair_standard_sbin);
15021497

15031498
let (session_user, session_home) = session_user_and_home(policy, workspace.home());
15041499
apply_child_env(
@@ -1862,13 +1857,8 @@ mod tests {
18621857
assert_eq!(cmd.get_args().count(), 0);
18631858

18641859
// Explicit command → login-shell flag + command, still on the given shell.
1865-
let cmd = build_ssh_shell_command(
1866-
"/bin/sh",
1867-
Some("echo hi".into()),
1868-
false,
1869-
Some("-i"),
1870-
false,
1871-
);
1860+
let cmd =
1861+
build_ssh_shell_command("/bin/sh", Some("echo hi".into()), false, Some("-i"), false);
18721862
assert_eq!(cmd.get_program(), OsStr::new("/bin/sh"));
18731863
assert_eq!(
18741864
cmd.get_args().collect::<Vec<_>>(),

0 commit comments

Comments
 (0)