Inject environment variables into getExecOutput()

This commit is contained in:
IvanZosimov 2022-10-03 13:27:16 +02:00
parent 1225bf2b8a
commit 99eb4e7d58
2 changed files with 11 additions and 2 deletions

6
dist/index.js vendored
View File

@ -361,7 +361,11 @@ class DotnetCoreInstaller {
: DotnetCoreInstaller.installationDirectoryMac);
}
}
const { exitCode, stdout } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, { ignoreReturnCode: true });
const getExecOutputOptions = {
ignoreReturnCode: true,
env: process.env
};
const { exitCode, stdout } = yield exec.getExecOutput(`"${scriptPath}"`, scriptArguments, getExecOutputOptions);
if (exitCode) {
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);
}

View File

@ -244,10 +244,15 @@ export class DotnetCoreInstaller {
);
}
}
const getExecOutputOptions = {
ignoreReturnCode: true,
env: process.env as {string: string}
};
const {exitCode, stdout} = await exec.getExecOutput(
`"${scriptPath}"`,
scriptArguments,
{ignoreReturnCode: true}
getExecOutputOptions
);
if (exitCode) {
throw new Error(`Failed to install dotnet ${exitCode}. ${stdout}`);