chore: route exec logging through logger

main
Peter Steinberger 2025-11-25 04:11:02 +01:00
parent 28277a298a
commit 39cd9bde1f
1 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import { execFile, spawn } from "node:child_process"; import { execFile, spawn } from "node:child_process";
import { danger, isVerbose } from "../globals.js"; import { danger, isVerbose } from "../globals.js";
import { logDebug, logError } from "../logger.js";
// Simple promise-wrapped execFile with optional verbosity logging. // Simple promise-wrapped execFile with optional verbosity logging.
export async function runExec( export async function runExec(
@ -13,13 +14,13 @@ export async function runExec(
timeout: timeoutMs, timeout: timeoutMs,
}); });
if (isVerbose()) { if (isVerbose()) {
if (stdout.trim()) console.log(stdout.trim()); if (stdout.trim()) logDebug(stdout.trim());
if (stderr.trim()) console.error(stderr.trim()); if (stderr.trim()) logError(stderr.trim());
} }
return { stdout, stderr }; return { stdout, stderr };
} catch (err) { } catch (err) {
if (isVerbose()) { if (isVerbose()) {
console.error(danger(`Command failed: ${command} ${args.join(" ")}`)); logError(danger(`Command failed: ${command} ${args.join(" ")}`));
} }
throw err; throw err;
} }