Skip to content

Commit 490d05a

Browse files
committed
fix: SSH background spawn env vars and tilde path expansion
- Add NON_INTERACTIVE_ENV_VARS to SSH background spawns (parity with local) - Use expanded paths in buildSpawnCommand so tilde resolves correctly
1 parent 92ef0c8 commit 490d05a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/node/runtime/SSHRuntime.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,9 @@ export class SSHRuntime implements Runtime {
323323
wrapperParts.push(cdCommandForSSH(options.cwd));
324324

325325
// Add environment variable exports (use shellQuote for parity with Local)
326-
if (options.env) {
327-
for (const [key, value] of Object.entries(options.env)) {
328-
wrapperParts.push(`export ${key}=${shellQuote(value)}`);
329-
}
326+
const envVars = { ...options.env, ...NON_INTERACTIVE_ENV_VARS };
327+
for (const [key, value] of Object.entries(envVars)) {
328+
wrapperParts.push(`export ${key}=${shellQuote(value)}`);
330329
}
331330

332331
// Add the actual script
@@ -335,12 +334,11 @@ export class SSHRuntime implements Runtime {
335334
const wrapperScript = wrapperParts.join(" && ");
336335

337336
// Use shared buildSpawnCommand for parity with Local
338-
// Note: stdoutPathExpanded/stderrPathExpanded are already quoted by expandTildeForSSH
339-
// so we pass them directly without the buildSpawnCommand quoting
337+
// Pass expanded paths so tilde is resolved (buildSpawnCommand quotes them)
340338
const spawnCommand = buildSpawnCommand({
341339
wrapperScript,
342-
stdoutPath: stdoutPath, // Will be quoted by buildSpawnCommand
343-
stderrPath: stderrPath, // Will be quoted by buildSpawnCommand
340+
stdoutPath: stdoutPathExpanded,
341+
stderrPath: stderrPathExpanded,
344342
niceness: options.niceness,
345343
});
346344

0 commit comments

Comments
 (0)