Skip to content

Commit 2a24ed1

Browse files
committed
fix: stabilize cross-platform release checks
1 parent 1f12e89 commit 2a24ed1

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/main/crew-integration-verification.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ const runner: IntegrationGitRunner = async (cwd, args) => {
4747
}
4848

4949
const runCheck = async (cwd: string, check: { command: string; args: string[] }) => {
50-
const result = spawnSync(check.command, check.args, { cwd, encoding: 'utf8', env: { ...process.env, CI: '1' } })
50+
const result = spawnSync(check.command, check.args, {
51+
cwd, encoding: 'utf8', env: { ...process.env, CI: '1' },
52+
// npm/pnpm/yarn are .cmd shims on Windows and require cmd.exe.
53+
shell: process.platform === 'win32',
54+
})
5155
return { code: result.status ?? 1, output: `${result.stdout ?? ''}${result.stderr ?? ''}` }
5256
}
5357

‎src/main/git.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ async function runCrewCheck(
192192
const child = execFile(check.command, check.args, {
193193
cwd,
194194
env: { ...process.env, CI: '1', CREWCODE_CHECK_TOKEN: token },
195+
// npm/pnpm/yarn are .cmd shims on Windows and cannot be launched by
196+
// execFile without cmd.exe. Commands and args come from the allowlist.
197+
shell: process.platform === 'win32',
195198
timeout: 120_000,
196199
maxBuffer: 10 * 1024 * 1024,
197200
}, (error, stdout, stderr) => {

‎src/main/remote-access-server.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ describe('remote access server', () => {
9898
})
9999
// /bin/sh does not exist on Windows. node is the one interpreter guaranteed
100100
// to be present wherever this suite runs.
101-
const create = await rpc('pty', 'pty.create', { paneId: 'web-test', cwd: root, shell: process.execPath, argv: ['-e', 'process.stdout.write("remote-pty-ok")'] })
101+
// Keep the process alive briefly after the write completes. A zero-lived
102+
// process can exit before macOS's native PTY dispatches its final data event.
103+
const script = 'process.stdout.write("remote-pty-ok", () => setTimeout(() => process.exit(0), 50))'
104+
const create = await rpc('pty', 'pty.create', { paneId: 'web-test', cwd: root, shell: process.execPath, argv: ['-e', script] })
102105
expect(create.status).toBe(200)
103106
await expect(output).resolves.toContain('remote-pty-ok')
104107
socket.close()

0 commit comments

Comments
 (0)