mirror of
https://github.com/threeal/cmake-action.git
synced 2026-02-28 07:50:49 +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:
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user