mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-31 16:14:00 +08:00 
			
		
		
		
	Throw error only if exit code is note zero. (#358)
This commit is contained in:
		| @@ -30,9 +30,16 @@ export const supportedPackageManagers: SupportedPackageManagers = { | ||||
| }; | ||||
|  | ||||
| export const getCommandOutput = async (toolCommand: string) => { | ||||
|   const {stdout, stderr, exitCode} = await exec.getExecOutput(toolCommand); | ||||
|   let {stdout, stderr, exitCode} = await exec.getExecOutput( | ||||
|     toolCommand, | ||||
|     undefined, | ||||
|     {ignoreReturnCode: true} | ||||
|   ); | ||||
|  | ||||
|   if (stderr) { | ||||
|   if (exitCode) { | ||||
|     stderr = !stderr.trim() | ||||
|       ? `The '${toolCommand}' command failed with exit code: ${exitCode}` | ||||
|       : stderr; | ||||
|     throw new Error(stderr); | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dmitry Shibanov
					Dmitry Shibanov