From c295b23c02c03f4f4cc2e1404898f5d5ff270a99 Mon Sep 17 00:00:00 2001 From: Adam Hall Date: Thu, 28 Aug 2025 10:07:24 +0930 Subject: [PATCH] Add more debug logging to the process events to help debug failing pipelines --- lib/cmd.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/cmd.ts b/lib/cmd.ts index 850fcee..a8c14d1 100644 --- a/lib/cmd.ts +++ b/lib/cmd.ts @@ -37,6 +37,30 @@ function asyncSpawn( const process = spawn(command, args, options); + process.stdout?.on("data", function (data) { + if (env.debug) { + console.log(`stdout: ${data}`); + } + }); + + process.stderr?.on("data", function (data) { + if (env.debug) { + console.log(`stderr: ${data}`); + } + }); + + process.on('close', function (code) { + if (env.debug) { + console.log(`child process close all stdio with code ${code}`); + } + }); + + process.on('disconnect', function () { + if (env.debug) { + console.log('child process disconnected'); + } + }); + process.on('exit', function (code) { if (code !== 0) reject(code); resolve(code);