semantic-version/src/CommandRunner.ts
Paul Hatcherian 31f4e3fdf0 Rewrite/refactor for v5, migrate to TypeScript (MAJOR)
Set Jest config file in package script

Include module path

Include tests in project folders

Remove index module exports

Hardcode configuration parameters

Move parameter binding into main run function

Use alias imports

Run test sequentially

Remove cleanup (async conflict)

Revert Jest option

Increase test timeout to 15 seconds
2022-04-03 20:28:28 -04:00

28 lines
No EOL
802 B
TypeScript

// Using require instead of import to support integration testing
import * as exec from '@actions/exec';
import * as core from '@actions/core';
export const cmd = async (command: string, ...args: any): Promise<string> => {
let output = '', errors = '';
const options = {
silent: true,
listeners: {
stdout: (data: any) => { output += data.toString(); },
stderr: (data: any) => { errors += data.toString(); },
ignoreReturnCode: true,
silent: true
}
};
try {
await exec.exec(command, args, options);
} catch (err) {
//core.info(`The command cd '${command} ${args.join(' ')}' failed: ${err}`);
}
if (errors !== '') {
//core.info(`stderr: ${errors}`);
}
return output;
};