Skip to content

Commit 584af5a

Browse files
authored
fix(ssh): record the archive lock owner's real PID (pingdotgg#14598)
1 parent 758d54a commit 584af5a

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎packages/ssh/src/tunnel.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ describe("ssh tunnel scripts", () => {
232232
assert.notInclude(script, "npx");
233233
});
234234

235+
it("embeds the runner in the launch script byte for byte", () => {
236+
const runner = buildRemoteT3RunnerScript(ARCHIVE);
237+
assert.include(runner, 'printf \'%s\\n\' "$$" > "$T3_LOCK/pid.tmp"');
238+
assert.include(buildRemoteLaunchScript(ARCHIVE), runner);
239+
});
240+
235241
it("uses the remote t3 runner for launch and pairing scripts", () => {
236242
const stateKey = "711bc738002d72fd";
237243
const launch = SshTunnel.buildRemoteLaunchScript(ARCHIVE);

‎packages/ssh/src/tunnel.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ function applyScriptPlaceholders(
240240
): string {
241241
let result = template;
242242
for (const [token, value] of Object.entries(replacements)) {
243-
result = result.replaceAll(`@@${token}@@`, value);
243+
// A replacer function keeps `$$` and other `$` patterns in the value literal.
244+
result = result.replaceAll(`@@${token}@@`, () => value);
244245
}
245246
return result;
246247
}

0 commit comments

Comments
 (0)