3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-06-19 06:43:41 +00:00

rewrite it all

This commit is contained in:
Arpad Borsos 2022-07-09 15:19:29 +02:00
parent 5df06440c6
commit 6ed4c28a7c
No known key found for this signature in database
GPG key ID: FC7BCA77824B3298
8 changed files with 527 additions and 466 deletions

29
src/utils.ts Normal file
View file

@ -0,0 +1,29 @@
import * as core from "@actions/core";
import * as exec from "@actions/exec";
export async function getCmdOutput(
cmd: string,
args: Array<string> = [],
options: exec.ExecOptions = {},
): Promise<string> {
let stdout = "";
let stderr = "";
try {
await exec.exec(cmd, args, {
silent: true,
listeners: {
stdout(data) {
stdout += data.toString();
},
stderr(data) {
stderr += data.toString();
},
},
...options,
});
} catch (e) {
core.error(stderr);
throw e;
}
return stdout;
}