fix: keep active ssh downloads alive

This commit is contained in:
Codex
2026-06-11 18:08:56 +00:00
parent 0a9d07c760
commit a8d49845ca
5 changed files with 132 additions and 23 deletions
+5 -2
View File
@@ -1679,25 +1679,28 @@ function combineCommandResults(command: string[], parts: CommandResult[]): Comma
}
function downloadRemoteFile(options: ArtifactRegistryOptions, remotePath: string, localPath: string, timeoutMs = options.timeoutMs): CommandResult {
const transferRuntimeTimeoutMs = Math.max(timeoutMs * 4, 60 * 60_000);
const command = [
process.execPath,
"scripts/cli.ts",
"ssh",
options.providerId,
"download",
"--inactivity-timeout-ms",
String(timeoutMs),
remotePath,
localPath,
];
const stdoutFile = process.env.UNIDESK_JOB_STDOUT_FILE;
const stderrFile = process.env.UNIDESK_JOB_STDERR_FILE;
if (!stdoutFile || !stderrFile) return runCommand(command, repoRoot, { timeoutMs });
if (!stdoutFile || !stderrFile) return runCommand(command, repoRoot, { timeoutMs: transferRuntimeTimeoutMs });
return runCommand([
"bash",
"-lc",
`set -o pipefail; "$@" > >(tee -a ${shellQuote(stdoutFile)}) 2> >(tee -a ${shellQuote(stderrFile)} >&2)`,
"unidesk-artifact-download",
...command,
], repoRoot, { timeoutMs });
], repoRoot, { timeoutMs: transferRuntimeTimeoutMs });
}
async function runRemoteScriptBackground(