Skip to content

Commit ad8542c

Browse files
Merge pull request #540 from dmitry-shibanov/fix-error-node-version
Fix error node version output
2 parents 5b949b5 + 3d11add commit ad8542c

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

dist/setup/index.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -71846,8 +71846,13 @@ function run() {
7184671846
yield installer.getNode(version, stable, checkLatest, auth, arch);
7184771847
}
7184871848
// Output version of node is being used
71849-
const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true });
71850-
core.setOutput('node-version', installedVersion);
71849+
try {
71850+
const { stdout: installedVersion } = yield exec.getExecOutput('node', ['--version'], { ignoreReturnCode: true, silent: true });
71851+
core.setOutput('node-version', installedVersion.trim());
71852+
}
71853+
catch (err) {
71854+
core.setOutput('node-version', '');
71855+
}
7185171856
const registryUrl = core.getInput('registry-url');
7185271857
const alwaysAuth = core.getInput('always-auth');
7185371858
if (registryUrl) {

src/main.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ export async function run() {
4141
}
4242

4343
// Output version of node is being used
44-
const {stdout: installedVersion} = await exec.getExecOutput(
45-
'node',
46-
['--version'],
47-
{ignoreReturnCode: true}
48-
);
49-
core.setOutput('node-version', installedVersion);
44+
try {
45+
const {stdout: installedVersion} = await exec.getExecOutput(
46+
'node',
47+
['--version'],
48+
{ignoreReturnCode: true, silent: true}
49+
);
50+
core.setOutput('node-version', installedVersion.trim());
51+
} catch (err) {
52+
core.setOutput('node-version', '');
53+
}
5054

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

0 commit comments

Comments
 (0)