From 57c0974c6cab4213d1a02876adfd7e06060822ce Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Sat, 10 Jan 2026 00:08:22 -0500 Subject: [PATCH 1/7] fix: ensure spawn-helper is executable for macos prebuilds Fixes https://github.com/microsoft/node-pty/issues/850 --- publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/publish.yml b/publish.yml index 12af8b650..19770caba 100644 --- a/publish.yml +++ b/publish.yml @@ -52,6 +52,8 @@ extends: - pwsh: | Get-ChildItem -Path . -Recurse -Directory -Name "_manifest" | Remove-Item -Recurse -Force displayName: 'Delete _manifest folders' + - bash: chmod +x prebuilds/darwin-*/spawn-helper + displayName: 'Ensure spawn-helper is executable' - script: npm ci displayName: 'Install dependencies and build' # The following script leaves the version unchanged for @@ -70,6 +72,8 @@ extends: branchName: 'refs/heads/main' artifactName: 'prebuilds' targetPath: 'prebuilds' + - bash: chmod +x prebuilds/darwin-*/spawn-helper + displayName: 'Ensure spawn-helper is executable' - script: npm ci displayName: 'Install dependencies and build' - script: npm test From 1a1452ce6dbef69ce58f6d64c47df4e5afb3eaac Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Sat, 10 Jan 2026 00:21:34 -0500 Subject: [PATCH 2/7] fix: Use authenticated download for sysroot to avoid rate limiting --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07530d699..95d69c0d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,9 @@ jobs: SYSROOT_PATH=$(node scripts/linux/install-sysroot.js ${{ steps.arch.outputs.arch }} | grep "SYSROOT_PATH=" | cut -d= -f2) echo "SYSROOT_PATH=$SYSROOT_PATH" >> $GITHUB_ENV echo "Sysroot path set to: $SYSROOT_PATH" + env: + # Set github token for authenticated sysroot download + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies and build run: npm ci From e80e3f86cf0c148b666fc990c505ed75f64fe30c Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Sat, 10 Jan 2026 00:35:00 -0500 Subject: [PATCH 3/7] fix: add parsing to reduce flakiness on macOS --- src/unixTerminal.test.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/unixTerminal.test.ts b/src/unixTerminal.test.ts index 69647468b..c81457001 100644 --- a/src/unixTerminal.test.ts +++ b/src/unixTerminal.test.ts @@ -280,12 +280,15 @@ if (process.platform !== 'win32') { let sub = ''; let pid = ''; p.stdout.on('data', (data) => { - if (!data.toString().indexOf('title')) { - sub = data.toString().split(' ')[1].slice(0, -1); - } else if (!data.toString().indexOf('ready')) { - pid = data.toString().split(' ')[1].slice(0, -1); - process.kill(parseInt(pid), 'SIGINT'); - p.kill('SIGINT'); + const lines = data.toString().split('\n'); + for (const line of lines) { + if (line.startsWith('title ')) { + sub = line.split(' ')[1]; + } else if (line.startsWith('ready ')) { + pid = line.split(' ')[1]; + process.kill(parseInt(pid), 'SIGINT'); + p.kill('SIGINT'); + } } }); p.on('exit', () => { From 29f9e73cb0181ab6e4419e517f9e1eafe5f62033 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Sat, 10 Jan 2026 00:57:22 -0500 Subject: [PATCH 4/7] chore: set -e to make failure point clear --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 95d69c0d9..b0d27fad3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: - name: Install sysroot if: runner.os == 'Linux' run: | + set -eo pipefail sudo apt-get update -qq if [ "${{ steps.arch.outputs.arch }}" = "arm64" ]; then sudo apt-get install -y gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu From 913fc14fcef175901b8351dd000c6c504c732830 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Sat, 10 Jan 2026 01:27:21 -0500 Subject: [PATCH 5/7] chore: direct debug logs to stderr --- scripts/linux/install-sysroot.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/linux/install-sysroot.js b/scripts/linux/install-sysroot.js index 4b68f2a54..426425eaf 100755 --- a/scripts/linux/install-sysroot.js +++ b/scripts/linux/install-sysroot.js @@ -48,29 +48,29 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) { signal: controller.signal }); if (response.ok && (response.status >= 200 && response.status < 300)) { - console.log(`Fetch completed: Status ${response.status}.`); + console.error(`Fetch completed: Status ${response.status}.`); const contents = Buffer.from(await response.arrayBuffer()); const asset = JSON.parse(contents.toString()).assets.find((a) => a.name === options.assetName); if (!asset) { throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`); } - console.log(`Found asset ${options.assetName} @ ${asset.url}.`); + console.error(`Found asset ${options.assetName} @ ${asset.url}.`); const assetResponse = await fetch(asset.url, { headers: ghDownloadHeaders }); if (assetResponse.ok && (assetResponse.status >= 200 && assetResponse.status < 300)) { const assetContents = Buffer.from(await assetResponse.arrayBuffer()); - console.log(`Fetched response body buffer: ${assetContents.byteLength} bytes`); + console.error(`Fetched response body buffer: ${assetContents.byteLength} bytes`); if (options.checksumSha256) { const actualSHA256Checksum = createHash('sha256').update(assetContents).digest('hex'); if (actualSHA256Checksum !== options.checksumSha256) { throw new Error(`Checksum mismatch for ${asset.url} (expected ${options.checksumSha256}, actual ${actualSHA256Checksum})`); } } - console.log(`Verified SHA256 checksums match for ${asset.url}`); + console.error(`Verified SHA256 checksums match for ${asset.url}`); const tarCommand = `tar -xz -C ${options.dest}`; execSync(tarCommand, { input: assetContents }); - console.log(`Fetch complete!`); + console.error(`Fetch complete!`); return; } throw new Error(`Request ${asset.url} failed with status code: ${assetResponse.status}`); @@ -81,7 +81,7 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) { } } catch (e) { if (retries > 0) { - console.log(`Fetching failed: ${e}`); + console.error(`Fetching failed: ${e}`); await new Promise(resolve => setTimeout(resolve, retryDelay)); return fetchUrl(options, retries - 1, retryDelay); } @@ -122,7 +122,7 @@ async function getSysroot(arch) { return result; } - console.log(`Installing ${arch} root image: ${sysroot}`); + console.error(`Installing ${arch} root image: ${sysroot}`); fs.rmSync(sysroot, { recursive: true, force: true }); fs.mkdirSync(sysroot, { recursive: true }); @@ -139,7 +139,7 @@ async function getSysroot(arch) { async function main() { const arch = process.argv[2] || process.env.ARCH || 'x64'; - console.log(`Installing sysroot for architecture: ${arch}`); + console.error(`Installing sysroot for architecture: ${arch}`); try { const sysrootPath = await getSysroot(arch); From 5a60c95135d8510404bc606d7d75f09f13852201 Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Sat, 10 Jan 2026 01:34:12 -0500 Subject: [PATCH 6/7] chore: add log for token use in downloading sysroot --- scripts/linux/install-sysroot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/linux/install-sysroot.js b/scripts/linux/install-sysroot.js index 426425eaf..97ac3022c 100755 --- a/scripts/linux/install-sysroot.js +++ b/scripts/linux/install-sysroot.js @@ -18,6 +18,7 @@ const ghApiHeaders = { if (process.env.GITHUB_TOKEN) { ghApiHeaders.Authorization = 'Basic ' + Buffer.from(process.env.GITHUB_TOKEN).toString('base64'); + console.error('Using GITHUB_TOKEN for authenticated requests to GitHub API.'); } const ghDownloadHeaders = { From 6a7f2066993ad4f4aa7708824e4a56893464011c Mon Sep 17 00:00:00 2001 From: Devraj Mehta Date: Sat, 10 Jan 2026 08:45:19 -0500 Subject: [PATCH 7/7] Revert "Ensure 755 permissions on prebuild spawn-helper" This reverts commit d08cd3684a7427eeb1bd5526ac83f8e30bf4d5d8. --- scripts/prebuild.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/prebuild.js b/scripts/prebuild.js index 5460c865e..17f1d980e 100644 --- a/scripts/prebuild.js +++ b/scripts/prebuild.js @@ -31,12 +31,4 @@ if (!fs.existsSync(PREBUILD_DIR)) { process.exit(1); } -// Ensure spawn-helper has execute permission (may be stripped by npm pack) -if (process.platform === 'darwin') { - const spawnHelper = path.join(PREBUILD_DIR, 'spawn-helper'); - if (fs.existsSync(spawnHelper)) { - fs.chmodSync(spawnHelper, 0o755); - } -} - process.exit(0);