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

Lines changed: 7 additions & 2 deletions
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

Lines changed: 10 additions & 6 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy