mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-21 11:01:20 +00:00
feat: log command based on spawned process arguments
Signed-off-by: Alfi Maulana <alfi.maulana.f@gmail.com>
This commit is contained in:
parent
7ad4029dc8
commit
c4a442b85f
2
dist/action.mjs
generated
vendored
2
dist/action.mjs
generated
vendored
@ -72,10 +72,10 @@ function logCommand(command, ...args) {
|
|||||||
*/
|
*/
|
||||||
async function exec(command, args) {
|
async function exec(command, args) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
logCommand(command, ...args);
|
|
||||||
const proc = spawn(command, args, {
|
const proc = spawn(command, args, {
|
||||||
stdio: ["ignore", "inherit", "inherit"],
|
stdio: ["ignore", "inherit", "inherit"],
|
||||||
});
|
});
|
||||||
|
logCommand(proc.spawnfile, ...proc.spawnargs.splice(1));
|
||||||
proc.on("error", reject);
|
proc.on("error", reject);
|
||||||
proc.on("close", (code) => {
|
proc.on("close", (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
@ -12,10 +12,10 @@ import { spawn } from "node:child_process";
|
|||||||
*/
|
*/
|
||||||
export async function exec(command: string, args: string[]): Promise<void> {
|
export async function exec(command: string, args: string[]): Promise<void> {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
logCommand(command, ...args);
|
|
||||||
const proc = spawn(command, args, {
|
const proc = spawn(command, args, {
|
||||||
stdio: ["ignore", "inherit", "inherit"],
|
stdio: ["ignore", "inherit", "inherit"],
|
||||||
});
|
});
|
||||||
|
logCommand(proc.spawnfile, ...proc.spawnargs.splice(1));
|
||||||
proc.on("error", reject);
|
proc.on("error", reject);
|
||||||
proc.on("close", (code) => {
|
proc.on("close", (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user