Skip to content

Commit d61fcfa

Browse files
authored
Group process output to make it more readable
1 parent a0ef72d commit d61fcfa

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/main.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,12 @@ async function execAndSucceed(
461461
args: string[],
462462
options: ExecOptions = {}
463463
): Promise<void> {
464-
debug(`running ${program} with arguments: ${JSON.stringify(args)}`);
465-
const exit = await _exec(program, args, options);
466-
if (exit !== 0) throw new Error(`${program} exited with code ${exit}`);
464+
return await core.group(`running ${program} with arguments: ${JSON.stringify(args)}`, async () => {
465+
const exit = await _exec(program, args, options);
466+
if (exit !== 0) {
467+
throw new Error(`${program} exited with code ${exit}`);
468+
}
469+
});
467470
}
468471

469472
async function toolExists(name: string): Promise<boolean> {
@@ -489,11 +492,13 @@ async function execWithOutput(
489492
program: string,
490493
args: string[]
491494
): Promise<string> {
492-
debug(`running ${program} with arguments: ${JSON.stringify(args)}`);
493-
const {exitCode, stdout} = await getExecOutput(program, args);
494-
if (exitCode !== 0)
495-
throw new Error(`${program} exited with code ${exitCode}`);
496-
return stdout;
495+
return await core.group(`running ${program} with arguments: ${JSON.stringify(args)}`, async () => {
496+
const {exitCode, stdout} = await getExecOutput(program, args);
497+
if (exitCode !== 0) {
498+
throw new Error(`${program} exited with code ${exitCode}`);
499+
}
500+
return stdout;
501+
});
497502
}
498503

499504
function realpath(path: string): string {

0 commit comments

Comments
 (0)