diff --git a/packages/ssh/src/tunnel.test.ts b/packages/ssh/src/tunnel.test.ts index f7f46926ddf913f8da86ff165b169b283a8f4f23..001852f98da13f4b2e0ffa7915170fb631432524 100644 --- a/packages/ssh/src/tunnel.test.ts +++ b/packages/ssh/src/tunnel.test.ts @@ -232,6 +232,12 @@ describe("ssh tunnel scripts", () => { assert.notInclude(script, "npx"); }); + it("embeds the runner in the launch script byte for byte", () => { + const runner = buildRemoteT3RunnerScript(ARCHIVE); + assert.include(runner, 'printf \'%s\\n\' "$$" > "$T3_LOCK/pid.tmp"'); + assert.include(buildRemoteLaunchScript(ARCHIVE), runner); + }); + it("uses the remote t3 runner for launch and pairing scripts", () => { const stateKey = "711bc738002d72fd"; const launch = SshTunnel.buildRemoteLaunchScript(ARCHIVE); diff --git a/packages/ssh/src/tunnel.ts b/packages/ssh/src/tunnel.ts index 6d70e381c04a46a8b024bb0f1bf7d9d244c5e235..c13e8d3768fa0d64744bff785fd670ccf524ed5a 100644 --- a/packages/ssh/src/tunnel.ts +++ b/packages/ssh/src/tunnel.ts @@ -240,7 +240,8 @@ function applyScriptPlaceholders( ): string { let result = template; for (const [token, value] of Object.entries(replacements)) { - result = result.replaceAll(`@@${token}@@`, value); + // A replacer function keeps `$$` and other `$` patterns in the value literal. + result = result.replaceAll(`@@${token}@@`, () => value); } return result; }