mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-08-20 07:35:10 +00:00
Fix compile errors
This commit is contained in:
parent
9d492aeb35
commit
b689c9945c
@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
@ -31,6 +30,13 @@ class DotnetCoreInstaller {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let output = '';
|
||||
let resultCode = 0;
|
||||
var envVariables = {};
|
||||
for (let key in process.env) {
|
||||
if (process.env[key]) {
|
||||
let value = process.env[key];
|
||||
envVariables[key] = value;
|
||||
}
|
||||
}
|
||||
if (IS_WINDOWS) {
|
||||
let escapedScript = path
|
||||
.join(__dirname, '..', 'externals', 'install-dotnet.ps1')
|
||||
@ -44,6 +50,14 @@ class DotnetCoreInstaller {
|
||||
}
|
||||
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
|
||||
const powershellPath = yield io.which('powershell', true);
|
||||
var options = {
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
output += data.toString();
|
||||
}
|
||||
},
|
||||
env: envVariables
|
||||
};
|
||||
resultCode = yield exec.exec(`"${powershellPath}"`, [
|
||||
'-NoLogo',
|
||||
'-Sta',
|
||||
@ -53,14 +67,7 @@ class DotnetCoreInstaller {
|
||||
'Unrestricted',
|
||||
'-Command',
|
||||
command
|
||||
], {
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
output += data.toString();
|
||||
}
|
||||
},
|
||||
env: process.env
|
||||
});
|
||||
], options);
|
||||
}
|
||||
else {
|
||||
let escapedScript = path
|
||||
@ -82,7 +89,7 @@ class DotnetCoreInstaller {
|
||||
output += data.toString();
|
||||
}
|
||||
},
|
||||
env: process.env
|
||||
env: envVariables
|
||||
});
|
||||
}
|
||||
if (resultCode != 0) {
|
||||
|
@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
@ -3,6 +3,7 @@ import * as exec from '@actions/exec';
|
||||
import * as io from '@actions/io';
|
||||
import {chmodSync} from 'fs';
|
||||
import * as path from 'path';
|
||||
import {ExecOptions} from '@actions/exec/lib/interfaces';
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
|
||||
@ -16,6 +17,14 @@ export class DotnetCoreInstaller {
|
||||
let output = '';
|
||||
let resultCode = 0;
|
||||
|
||||
var envVariables: {[key: string]: string} = {};
|
||||
for (let key in process.env) {
|
||||
if (process.env[key]) {
|
||||
let value: any = process.env[key];
|
||||
envVariables[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
let escapedScript = path
|
||||
.join(__dirname, '..', 'externals', 'install-dotnet.ps1')
|
||||
@ -30,6 +39,16 @@ export class DotnetCoreInstaller {
|
||||
|
||||
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
|
||||
const powershellPath = await io.which('powershell', true);
|
||||
|
||||
var options: ExecOptions = {
|
||||
listeners: {
|
||||
stdout: (data: Buffer) => {
|
||||
output += data.toString();
|
||||
}
|
||||
},
|
||||
env: envVariables
|
||||
};
|
||||
|
||||
resultCode = await exec.exec(
|
||||
`"${powershellPath}"`,
|
||||
[
|
||||
@ -42,14 +61,7 @@ export class DotnetCoreInstaller {
|
||||
'-Command',
|
||||
command
|
||||
],
|
||||
{
|
||||
listeners: {
|
||||
stdout: (data: Buffer) => {
|
||||
output += data.toString();
|
||||
}
|
||||
},
|
||||
env: process.env
|
||||
}
|
||||
options
|
||||
);
|
||||
} else {
|
||||
let escapedScript = path
|
||||
@ -74,7 +86,7 @@ export class DotnetCoreInstaller {
|
||||
output += data.toString();
|
||||
}
|
||||
},
|
||||
env: process.env
|
||||
env: envVariables
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user