Skip to content

Commit

Permalink
Merge pull request #540 from dmitry-shibanov/fix-error-node-version
Browse files Browse the repository at this point in the history
Fix error node version output
  • Loading branch information
marko-zivic-93 committed Jul 12, 2022
2 parents 5b949b5 + 3d11add commit ad8542c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
9 changes: 7 additions & 2 deletions dist/setup/index.js
Expand Up @@ -71846,8 +71846,13 @@ function run() {
yield installer.getNode(version, stable, checkLatest, auth, arch);
}
// Output version of node is being used
const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true });
core.setOutput('node-version', installedVersion);
try {
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 alwaysAuth = core.getInput('always-auth');
if (registryUrl) {
Expand Down
16 changes: 10 additions & 6 deletions src/main.ts
Expand Up @@ -41,12 +41,16 @@ export async function run() {
}

// Output version of node is being used
const {stdout: installedVersion} = await exec.getExecOutput(
'node',
['--version'],
{ignoreReturnCode: true}
);
core.setOutput('node-version', installedVersion);
try {
const {stdout: installedVersion} = await exec.getExecOutput(
'node',
['--version'],
{ignoreReturnCode: true, silent: true}
);
core.setOutput('node-version', installedVersion.trim());
} catch (err) {
core.setOutput('node-version', '');
}

const registryUrl: string = core.getInput('registry-url');
const alwaysAuth: string = core.getInput('always-auth');
Expand Down

0 comments on commit ad8542c

Please sign in to comment.