Merge pull request #540 from dmitry-shibanov/fix-error-node-version

Fix error node version output
pull/545/head
Marko Zivic 2022-07-12 15:59:02 +02:00 committed by GitHub
commit ad8542ca5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

9
dist/setup/index.js vendored
View File

@ -71846,8 +71846,13 @@ function run() {
yield installer.getNode(version, stable, checkLatest, auth, arch); yield installer.getNode(version, stable, checkLatest, auth, arch);
} }
// Output version of node is being used // Output version of node is being used
const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true }); try {
core.setOutput('node-version', installedVersion); const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true, silent: true });
core.setOutput('node-version', installedVersion.trim());
}
catch (err) {
core.setOutput('node-version', '');
}
const registryUrl = core.getInput('registry-url'); const registryUrl = core.getInput('registry-url');
const alwaysAuth = core.getInput('always-auth'); const alwaysAuth = core.getInput('always-auth');
if (registryUrl) { if (registryUrl) {

View File

@ -41,12 +41,16 @@ export async function run() {
} }
// Output version of node is being used // Output version of node is being used
const {stdout: installedVersion} = await exec.getExecOutput( try {
'node', const {stdout: installedVersion} = await exec.getExecOutput(
['--version'], 'node',
{ignoreReturnCode: true} ['--version'],
); {ignoreReturnCode: true, silent: true}
core.setOutput('node-version', installedVersion); );
core.setOutput('node-version', installedVersion.trim());
} catch (err) {
core.setOutput('node-version', '');
}
const registryUrl: string = core.getInput('registry-url'); const registryUrl: string = core.getInput('registry-url');
const alwaysAuth: string = core.getInput('always-auth'); const alwaysAuth: string = core.getInput('always-auth');