repo-tools: Add debug logging for empty stdout in createBinRunner

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-02-27 09:59:15 +01:00
parent 2481126013
commit f586daee1f
+18 -1
View File
@@ -15,7 +15,13 @@
*/
import { spawnSync } from 'node:child_process';
import { openSync, closeSync, readFileSync, unlinkSync } from 'node:fs';
import {
openSync,
closeSync,
readFileSync,
unlinkSync,
statSync,
} from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
@@ -42,8 +48,19 @@ export function createBinRunner(cwd: string, path: string) {
});
closeSync(outFd);
const fileSize = statSync(outPath).size;
const stdout = readFileSync(outPath, 'utf8');
// Temporary debug: log when file redirect produces no output
if (stdout.length === 0) {
console.error(
`[createBinRunner debug] empty stdout for: node ${args.join(' ')} ` +
`(exit=${result.status}, fileSize=${fileSize}, stderr=${(
result.stderr?.toString() ?? ''
).slice(0, 200)})`,
);
}
if (result.error) {
throw new Error(`Process error: ${result.error.message}`);
}