From c4a442b85f45aa77e8544254db6a047bdc1aa2c7 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Sat, 23 Nov 2024 14:10:28 +0700 Subject: [PATCH] feat: log command based on spawned process arguments Signed-off-by: Alfi Maulana --- dist/action.mjs | 2 +- src/exec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/action.mjs b/dist/action.mjs index eb53707..f639502 100644 --- a/dist/action.mjs +++ b/dist/action.mjs @@ -72,10 +72,10 @@ function logCommand(command, ...args) { */ async function exec(command, args) { return new Promise((resolve, reject) => { - logCommand(command, ...args); const proc = spawn(command, args, { stdio: ["ignore", "inherit", "inherit"], }); + logCommand(proc.spawnfile, ...proc.spawnargs.splice(1)); proc.on("error", reject); proc.on("close", (code) => { if (code === 0) { diff --git a/src/exec.ts b/src/exec.ts index e2cb4e1..2e3e00b 100644 --- a/src/exec.ts +++ b/src/exec.ts @@ -12,10 +12,10 @@ import { spawn } from "node:child_process"; */ export async function exec(command: string, args: string[]): Promise { return new Promise((resolve, reject) => { - logCommand(command, ...args); const proc = spawn(command, args, { stdio: ["ignore", "inherit", "inherit"], }); + logCommand(proc.spawnfile, ...proc.spawnargs.splice(1)); proc.on("error", reject); proc.on("close", (code) => { if (code === 0) {