1437
return cliBin;
1438
}
1440
>
reportProgress(localize('sshProgressDownloadingCLI', "Installing VS Code CLI on remote..."));
1441
>
const url = buildCLIDownloadUrl(platform.os, platform.arch, this._quality, commit);
1442
>
1443
>
// Extract into a temp dir inside the install root so the final `mv`
1444
>
// is a same-filesystem atomic rename. Concurrent SSH sessions racing
1445
>
// here both end up with a valid binary for the same commit; the
1446
>
// trailing `rm -rf` of the tmp dir is idempotent.
1447
>
const installCmd = [
1448
>
`mkdir -p ${installRoot}`,
1449
>
`tmpdir=$(mktemp -d ${installRoot}/.cli-install-XXXXXX)`,
1450
>
`(cd "$tmpdir" && curl -fsSL ${shellEscape(url)} | tar xz)`,
1451
>
// The archive contains exactly one file: the CLI binary, named per quality.
1452
>
`mv "$tmpdir"/* ${cliBin}`,
1453
>
`chmod +x ${cliBin}`,
1454
>
`rm -rf "$tmpdir"`,
1455
>
].join(' && ');
1456
>
1457
>
try {
1458
>
await sshExec(client, installCmd);
1459
// Validate the installed binary actually runs. If the archive was
1460
// for the wrong platform / corrupted, this surfaces immediately.