Changing env process and fixing quoting

This commit is contained in:
Tim Heuer 2020-02-11 09:40:56 -08:00
parent 6fdb4e0384
commit 9fa19eb771
2 changed files with 9 additions and 6 deletions

6
dist/index.js vendored
View File

@ -977,7 +977,7 @@ const io = __importStar(__webpack_require__(1));
const IS_WINDOWS = process.platform === 'win32';
const VS_VERSION = core.getInput('vs-version') || 'latest';
const VSWHERE_PATH = core.getInput('vswhere-path') ||
'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer';
path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio\\Installer');
// if a specific version of VS is requested
let VSWHERE_EXEC = '';
if (VS_VERSION === 'latest') {
@ -1017,7 +1017,7 @@ function run() {
core.setFailed('setup-msbuild requires the path to where vswhere.exe exists');
}
}
core.debug(`Full cached tool exe: ${vswhereToolExe}`);
core.debug(`Full tool exe: ${vswhereToolExe}`);
let foundToolPath = '';
const options = {};
options.listeners = {
@ -1028,7 +1028,7 @@ function run() {
}
};
// execute the find putting the result of the command in the options foundToolPath
yield exec.exec(`${vswhereToolExe} ${VSWHERE_EXEC}`, [], options);
yield exec.exec(`"${vswhereToolExe}" ${VSWHERE_EXEC}`, [], options);
if (!foundToolPath) {
core.setFailed('Unable to find msbuild.');
return;

View File

@ -8,7 +8,10 @@ const IS_WINDOWS = process.platform === 'win32'
const VS_VERSION = core.getInput('vs-version') || 'latest'
const VSWHERE_PATH =
core.getInput('vswhere-path') ||
'C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer'
path.join(
process.env['ProgramFiles(x86)'] as string,
'Microsoft Visual Studio\\Installer'
)
// if a specific version of VS is requested
let VSWHERE_EXEC = ''
@ -51,7 +54,7 @@ async function run(): Promise<void> {
}
}
core.debug(`Full cached tool exe: ${vswhereToolExe}`)
core.debug(`Full tool exe: ${vswhereToolExe}`)
let foundToolPath = ''
const options: ExecOptions = {}
@ -64,7 +67,7 @@ async function run(): Promise<void> {
}
// execute the find putting the result of the command in the options foundToolPath
await exec.exec(`${vswhereToolExe} ${VSWHERE_EXEC}`, [], options)
await exec.exec(`"${vswhereToolExe}" ${VSWHERE_EXEC}`, [], options)
if (!foundToolPath) {
core.setFailed('Unable to find msbuild.')