Skip to content
This repository was archived by the owner on Apr 24, 2026. It is now read-only.

Commit f15fffc

Browse files
lanmowerclaude
andcommitted
fix: use node instead of bun for exec-process on Windows
Bun has a stdio bug (TODO: stream.Readable stdio @ 1) that causes exec-process to crash when piped. Running exec-process under Node fixes long-running server processes (http.listen stays alive). Also add file-based logging to exec-process for debugging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c26dcea commit f15fffc

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/exec-process.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,22 @@ process.stdin.on('data', (data) => {
3232
}
3333
});
3434

35+
const _logOut = process.env.GM_EXEC_LOG_OUT ? require('fs').createWriteStream(process.env.GM_EXEC_LOG_OUT, { flags: 'a' }) : null;
36+
const _logErr = process.env.GM_EXEC_LOG_ERR ? require('fs').createWriteStream(process.env.GM_EXEC_LOG_ERR, { flags: 'a' }) : null;
37+
3538
async function runChild(child, cleanup) {
3639
activeChild = child;
3740
let stdout = '', stderr = '';
3841
child.stdout?.on('data', async (d) => {
3942
const str = d.toString('utf8');
4043
stdout += str;
41-
process.stdout.write(str);
44+
if (_logOut) _logOut.write(str);
4245
await rpc('appendOutput', { taskId, type: 'stdout', data: str });
4346
});
4447
child.stderr?.on('data', async (d) => {
4548
const str = d.toString('utf8');
4649
stderr += str;
47-
process.stderr.write(str);
50+
if (_logErr) _logErr.write(str);
4851
await rpc('appendOutput', { taskId, type: 'stderr', data: str });
4952
});
5053
return new Promise((resolve) => {

src/task-runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ async function startExecProcess(taskId, code, runtime, workingDirectory) {
7878
childEnv.RUNTIME = runtime
7979
childEnv.CWD = workingDirectory
8080
childEnv.CODE_FILE = codeFile
81-
const proc = nodeSpawn('bun', [EXEC_PROCESS_SCRIPT], {
81+
const proc = nodeSpawn('node', [EXEC_PROCESS_SCRIPT], {
8282
env: childEnv,
8383
cwd: workingDirectory || process.cwd(),
8484
stdio: ['pipe', 'pipe', 'pipe'],

0 commit comments

Comments
 (0)