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