mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 01:25:38 -05:00
VS Code merge to df8fe74bd55313de0dd2303bc47a4aab0ca56b0e (#17979)
* Merge from vscode 504f934659740e9d41501cad9f162b54d7745ad9 * delete unused folders * distro * Bump build node version * update chokidar * FIx hygiene errors * distro * Fix extension lint issues * Remove strict-vscode * Add copyright header exemptions * Bump vscode-extension-telemetry to fix webpacking issue with zone.js * distro * Fix failing tests (revert marked.js back to current one until we decide to update) * Skip searchmodel test * Fix mac build * temp debug script loading * Try disabling coverage * log error too * Revert "log error too" This reverts commit af0183e5d4ab458fdf44b88fbfab9908d090526f. * Revert "temp debug script loading" This reverts commit 3d687d541c76db2c5b55626c78ae448d3c25089c. * Add comments explaining coverage disabling * Fix ansi_up loading issue * Merge latest from ads * Use newer option * Fix compile * add debug logging warn * Always log stack * log more * undo debug * Update to use correct base path (+cleanup) * distro * fix compile errors * Remove strict-vscode * Fix sql editors not showing * Show db dropdown input & fix styling * Fix more info in gallery * Fix gallery asset requests * Delete unused workflow * Fix tapable resolutions for smoke test compile error * Fix smoke compile * Disable crash reporting * Disable interactive Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
@@ -22,7 +22,7 @@ export interface ITerminalForPlatform {
|
||||
|
||||
export interface IExternalTerminalService {
|
||||
readonly _serviceBrand: undefined;
|
||||
openTerminal(path: string): Promise<void>;
|
||||
openTerminal(configuration: IExternalTerminalSettings, cwd: string | undefined): Promise<void>;
|
||||
runInTerminal(title: string, cwd: string, args: string[], env: ITerminalEnvironment, settings: IExternalTerminalSettings): Promise<number | undefined>;
|
||||
getDefaultTerminalForPlatforms(): Promise<ITerminalForPlatform>;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { deepEqual, equal } from 'assert';
|
||||
import { DEFAULT_TERMINAL_OSX } from 'vs/platform/externalTerminal/common/externalTerminal';
|
||||
import { WindowsExternalTerminalService, MacExternalTerminalService, LinuxExternalTerminalService } from 'vs/platform/externalTerminal/node/externalTerminalService';
|
||||
import { LinuxExternalTerminalService, MacExternalTerminalService, WindowsExternalTerminalService } from 'vs/platform/externalTerminal/node/externalTerminalService';
|
||||
|
||||
suite('ExternalTerminalService', () => {
|
||||
let mockOnExit: Function;
|
||||
@@ -42,7 +42,7 @@ suite('ExternalTerminalService', () => {
|
||||
};
|
||||
}
|
||||
};
|
||||
let testService = new WindowsExternalTerminalService(mockConfig);
|
||||
let testService = new WindowsExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -67,7 +67,7 @@ suite('ExternalTerminalService', () => {
|
||||
}
|
||||
};
|
||||
mockConfig.terminal.external.windowsExec = undefined;
|
||||
let testService = new WindowsExternalTerminalService(mockConfig);
|
||||
let testService = new WindowsExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -91,7 +91,7 @@ suite('ExternalTerminalService', () => {
|
||||
};
|
||||
}
|
||||
};
|
||||
let testService = new WindowsExternalTerminalService(mockConfig);
|
||||
let testService = new WindowsExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -115,7 +115,7 @@ suite('ExternalTerminalService', () => {
|
||||
return { on: (evt: any) => evt };
|
||||
}
|
||||
};
|
||||
let testService = new WindowsExternalTerminalService(mockConfig);
|
||||
let testService = new WindowsExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -137,7 +137,7 @@ suite('ExternalTerminalService', () => {
|
||||
return { on: (evt: any) => evt };
|
||||
}
|
||||
};
|
||||
let testService = new WindowsExternalTerminalService(mockConfig);
|
||||
let testService = new WindowsExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -160,7 +160,7 @@ suite('ExternalTerminalService', () => {
|
||||
};
|
||||
}
|
||||
};
|
||||
let testService = new MacExternalTerminalService(mockConfig);
|
||||
let testService = new MacExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -183,7 +183,7 @@ suite('ExternalTerminalService', () => {
|
||||
}
|
||||
};
|
||||
mockConfig.terminal.external.osxExec = undefined;
|
||||
let testService = new MacExternalTerminalService(mockConfig);
|
||||
let testService = new MacExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -206,7 +206,7 @@ suite('ExternalTerminalService', () => {
|
||||
};
|
||||
}
|
||||
};
|
||||
let testService = new LinuxExternalTerminalService(mockConfig);
|
||||
let testService = new LinuxExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
@@ -230,7 +230,7 @@ suite('ExternalTerminalService', () => {
|
||||
}
|
||||
};
|
||||
mockConfig.terminal.external.linuxExec = undefined;
|
||||
let testService = new LinuxExternalTerminalService(mockConfig);
|
||||
let testService = new LinuxExternalTerminalService();
|
||||
(<any>testService).spawnTerminal(
|
||||
mockSpawner,
|
||||
mockConfig,
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IExternalTerminalService } from 'vs/platform/externalTerminal/common/externalTerminal';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { registerMainProcessRemoteService } from 'vs/platform/ipc/electron-sandbox/services';
|
||||
import { IExternalTerminalService } from 'vs/platform/externalTerminal/common/externalTerminal';
|
||||
|
||||
export const IExternalTerminalMainService = createDecorator<IExternalTerminalMainService>('externalTerminal');
|
||||
|
||||
|
||||
@@ -4,17 +4,15 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as cp from 'child_process';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as env from 'vs/base/common/platform';
|
||||
import { sanitizeProcessEnvironment } from 'vs/base/common/processes';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import * as processes from 'vs/base/node/processes';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import * as env from 'vs/base/common/platform';
|
||||
import { IExternalTerminalConfiguration, IExternalTerminalSettings, DEFAULT_TERMINAL_OSX, ITerminalForPlatform, IExternalTerminalMainService } from 'vs/platform/externalTerminal/common/externalTerminal';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { optional } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileAccess } from 'vs/base/common/network';
|
||||
import { DEFAULT_TERMINAL_OSX, IExternalTerminalMainService, IExternalTerminalSettings, ITerminalForPlatform } from 'vs/platform/externalTerminal/common/externalTerminal';
|
||||
import { ITerminalEnvironment } from 'vs/platform/terminal/common/terminal';
|
||||
import { sanitizeProcessEnvironment } from 'vs/base/common/processes';
|
||||
|
||||
const TERMINAL_TITLE = nls.localize('console.title', "VS Code Console");
|
||||
|
||||
@@ -22,8 +20,11 @@ abstract class ExternalTerminalService {
|
||||
public _serviceBrand: undefined;
|
||||
|
||||
async getDefaultTerminalForPlatforms(): Promise<ITerminalForPlatform> {
|
||||
const linuxTerminal = await LinuxExternalTerminalService.getDefaultTerminalLinuxReady();
|
||||
return { windows: WindowsExternalTerminalService.getDefaultTerminalWindows(), linux: linuxTerminal, osx: 'xterm' };
|
||||
return {
|
||||
windows: WindowsExternalTerminalService.getDefaultTerminalWindows(),
|
||||
linux: await LinuxExternalTerminalService.getDefaultTerminalLinuxReady(),
|
||||
osx: 'xterm'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,20 +32,12 @@ export class WindowsExternalTerminalService extends ExternalTerminalService impl
|
||||
private static readonly CMD = 'cmd.exe';
|
||||
private static _DEFAULT_TERMINAL_WINDOWS: string;
|
||||
|
||||
constructor(
|
||||
@optional(IConfigurationService) private readonly _configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
public openTerminal(cwd?: string): Promise<void> {
|
||||
const configuration = this._configurationService.getValue<IExternalTerminalConfiguration>();
|
||||
public openTerminal(configuration: IExternalTerminalSettings, cwd?: string): Promise<void> {
|
||||
return this.spawnTerminal(cp, configuration, processes.getWindowsShell(), cwd);
|
||||
}
|
||||
|
||||
public spawnTerminal(spawner: typeof cp, configuration: IExternalTerminalConfiguration, command: string, cwd?: string): Promise<void> {
|
||||
const terminalConfig = configuration.terminal.external;
|
||||
const exec = terminalConfig?.windowsExec || WindowsExternalTerminalService.getDefaultTerminalWindows();
|
||||
public spawnTerminal(spawner: typeof cp, configuration: IExternalTerminalSettings, command: string, cwd?: string): Promise<void> {
|
||||
const exec = configuration.windowsExec || WindowsExternalTerminalService.getDefaultTerminalWindows();
|
||||
|
||||
// Make the drive letter uppercase on Windows (see #9448)
|
||||
if (cwd && cwd[1] === ':') {
|
||||
@@ -124,14 +117,7 @@ export class WindowsExternalTerminalService extends ExternalTerminalService impl
|
||||
export class MacExternalTerminalService extends ExternalTerminalService implements IExternalTerminalMainService {
|
||||
private static readonly OSASCRIPT = '/usr/bin/osascript'; // osascript is the AppleScript interpreter on OS X
|
||||
|
||||
constructor(
|
||||
@optional(IConfigurationService) private readonly _configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
public openTerminal(cwd?: string): Promise<void> {
|
||||
const configuration = this._configurationService.getValue<IExternalTerminalConfiguration>();
|
||||
public openTerminal(configuration: IExternalTerminalSettings, cwd?: string): Promise<void> {
|
||||
return this.spawnTerminal(cp, configuration, cwd);
|
||||
}
|
||||
|
||||
@@ -161,8 +147,11 @@ export class MacExternalTerminalService extends ExternalTerminalService implemen
|
||||
}
|
||||
|
||||
if (envVars) {
|
||||
for (let key in envVars) {
|
||||
const value = envVars[key];
|
||||
// merge environment variables into a copy of the process.env
|
||||
const env = Object.assign({}, getSanitizedEnvironment(process), envVars);
|
||||
|
||||
for (let key in env) {
|
||||
const value = env[key];
|
||||
if (value === null) {
|
||||
osaArgs.push('-u');
|
||||
osaArgs.push(key);
|
||||
@@ -199,16 +188,16 @@ export class MacExternalTerminalService extends ExternalTerminalService implemen
|
||||
});
|
||||
}
|
||||
|
||||
spawnTerminal(spawner: typeof cp, configuration: IExternalTerminalConfiguration, cwd?: string): Promise<void> {
|
||||
const terminalConfig = configuration.terminal.external;
|
||||
const terminalApp = terminalConfig?.osxExec || DEFAULT_TERMINAL_OSX;
|
||||
spawnTerminal(spawner: typeof cp, configuration: IExternalTerminalSettings, cwd?: string): Promise<void> {
|
||||
const terminalApp = configuration.osxExec || DEFAULT_TERMINAL_OSX;
|
||||
|
||||
return new Promise<void>((c, e) => {
|
||||
const args = ['-a', terminalApp];
|
||||
if (cwd) {
|
||||
args.push(cwd);
|
||||
}
|
||||
const child = spawner.spawn('/usr/bin/open', args);
|
||||
const env = getSanitizedEnvironment(process);
|
||||
const child = spawner.spawn('/usr/bin/open', args, { cwd, env });
|
||||
child.on('error', e);
|
||||
child.on('exit', () => c());
|
||||
});
|
||||
@@ -219,14 +208,7 @@ export class LinuxExternalTerminalService extends ExternalTerminalService implem
|
||||
|
||||
private static readonly WAIT_MESSAGE = nls.localize('press.any.key', "Press any key to continue...");
|
||||
|
||||
constructor(
|
||||
@optional(IConfigurationService) private readonly _configurationService: IConfigurationService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
public openTerminal(cwd?: string): Promise<void> {
|
||||
const configuration = this._configurationService.getValue<IExternalTerminalConfiguration>();
|
||||
public openTerminal(configuration: IExternalTerminalSettings, cwd?: string): Promise<void> {
|
||||
return this.spawnTerminal(cp, configuration, cwd);
|
||||
}
|
||||
|
||||
@@ -251,8 +233,9 @@ export class LinuxExternalTerminalService extends ExternalTerminalService implem
|
||||
const bashCommand = `${quote(args)}; echo; read -p "${LinuxExternalTerminalService.WAIT_MESSAGE}" -n1;`;
|
||||
termArgs.push(`''${bashCommand}''`); // wrapping argument in two sets of ' because node is so "friendly" that it removes one set...
|
||||
|
||||
|
||||
// merge environment variables into a copy of the process.env
|
||||
const env = Object.assign({}, process.env, envVars);
|
||||
const env = Object.assign({}, getSanitizedEnvironment(process), envVars);
|
||||
|
||||
// delete environment variables that have a null value
|
||||
Object.keys(env).filter(v => env[v] === null).forEach(key => delete env[key]);
|
||||
@@ -314,9 +297,8 @@ export class LinuxExternalTerminalService extends ExternalTerminalService implem
|
||||
return LinuxExternalTerminalService._DEFAULT_TERMINAL_LINUX_READY;
|
||||
}
|
||||
|
||||
spawnTerminal(spawner: typeof cp, configuration: IExternalTerminalConfiguration, cwd?: string): Promise<void> {
|
||||
const terminalConfig = configuration.terminal.external;
|
||||
const execPromise = terminalConfig?.linuxExec ? Promise.resolve(terminalConfig.linuxExec) : LinuxExternalTerminalService.getDefaultTerminalLinuxReady();
|
||||
spawnTerminal(spawner: typeof cp, configuration: IExternalTerminalSettings, cwd?: string): Promise<void> {
|
||||
const execPromise = configuration.linuxExec ? Promise.resolve(configuration.linuxExec) : LinuxExternalTerminalService.getDefaultTerminalLinuxReady();
|
||||
|
||||
return new Promise<void>((c, e) => {
|
||||
execPromise.then(exec => {
|
||||
@@ -330,7 +312,7 @@ export class LinuxExternalTerminalService extends ExternalTerminalService implem
|
||||
}
|
||||
|
||||
function getSanitizedEnvironment(process: NodeJS.Process) {
|
||||
const env = process.env;
|
||||
const env = { ...process.env };
|
||||
sanitizeProcessEnvironment(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user