Skip to content

Commit a25d01c

Browse files
committed
Fix SSH init hook test: commit hook to git and use #!/bin/bash
1 parent 3b5ebfe commit a25d01c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/ipcMain/initWorkspace.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async function createTempGitRepoWithInitHook(options: {
6666

6767
let scriptContent: string;
6868
if (options.customScript) {
69-
scriptContent = `#!/usr/bin/env bash\n${options.customScript}\nexit ${options.exitCode}\n`;
69+
scriptContent = `#!/bin/bash\n${options.customScript}\nexit ${options.exitCode}\n`;
7070
} else {
7171
const sleepCmd = options.sleepBetweenLines ? `sleep ${options.sleepBetweenLines / 1000}` : "";
7272

@@ -79,11 +79,14 @@ async function createTempGitRepoWithInitHook(options: {
7979

8080
const stderrCmds = (options.stderrLines ?? []).map((line) => `echo "${line}" >&2`).join("\n");
8181

82-
scriptContent = `#!/usr/bin/env bash\n${stdoutCmds}\n${stderrCmds}\nexit ${options.exitCode}\n`;
82+
scriptContent = `#!/bin/bash\n${stdoutCmds}\n${stderrCmds}\nexit ${options.exitCode}\n`;
8383
}
8484

8585
await fs.writeFile(hookPath, scriptContent, { mode: 0o755 });
8686

87+
// Commit the init hook (required for SSH runtime - git worktree syncs committed files)
88+
await execAsync(`git add -A && git commit -m "Add init hook"`, { cwd: tempDir });
89+
8790
return tempDir;
8891
}
8992

0 commit comments

Comments
 (0)