feat: log command based on spawned process arguments

Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
Alfi Maulana 2024-11-23 14:10:28 +07:00
parent 7ad4029dc8
commit c4a442b85f
No known key found for this signature in database
GPG Key ID: 2242A64C2A8DF5A4
2 changed files with 2 additions and 2 deletions

2
dist/action.mjs generated vendored
View File

@ -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) {

View File

@ -12,10 +12,10 @@ import { spawn } from "node:child_process";
*/
export async function exec(command: string, args: string[]): Promise<void> {
return new Promise<void>((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) {