chore: add temporary P2 child debug channel for acceptance diagnosis

This commit is contained in:
2026-08-11 19:26:57 +02:00
parent e3dd5897f8
commit f6c2e6fc40
3 changed files with 17 additions and 3 deletions
+9 -2
View File
@@ -249,8 +249,15 @@ function createProductionService(): WorkspacePreprocessingService {
let stderr = "";
child.stdout?.on("data", (chunk: Buffer) => { stdout += chunk.toString("utf8"); });
child.stderr?.on("data", (chunk: Buffer) => { stderr += chunk.toString("utf8"); });
child.on("close", (code) => resolve({ exitCode: code ?? 0, stdout, stderr }));
child.on("error", (error) => resolve({ exitCode: 1, stdout, stderr: String(error.message) }));
child.on("close", (code) => {
const capped = { exitCode: code ?? 0, stdout, stderr: stderr.slice(0, 64 * 1024) };
if (process.env.P2_CHILD_DEBUG === "1" && (code ?? 0) !== 0) {
capped.stdout = stdout.slice(0, 4096);
capped.stderr = stderr.slice(0, 4096);
}
resolve(capped);
});
child.on("error", (error) => resolve({ exitCode: 1, stdout, stderr: String(error.message).slice(0, 4096) }));
});
} finally {
closeSync(configFd);