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