Use actions exec instead

Signed-off-by: Xuanwo <github@xuanwo.io>
This commit is contained in:
Xuanwo
2023-01-11 11:31:10 +08:00
parent 4a85108bfd
commit bdadfb55a2

View File

@@ -13,23 +13,24 @@
// limitations under the License.
import * as core from '@actions/core';
import {exec} from 'child_process';
import * as exec from '@actions/exec';
async function show_stats() {
core.debug('start sccache show starts');
exec(
`${process.env.SCCACHE_PATH} --show-stats`,
(err: any, stdout: any, stderr: any) => {
core.info(stdout);
core.warning(stderr);
if (err) {
core.error('failed to show sccache stats');
throw new Error(err);
}
const defaultListener = {
stdout: (data: Buffer) => {
stdout.push(data.toString());
}
);
};
const stdout: string[] = [];
await exec.exec(`${process.env.SCCACHE_PATH}`, ['--show-stats'], {
listeners: defaultListener
});
core.info(stdout.join(''));
}
show_stats().catch(err => {