electron - save some changes that are OK with 1.7.x
This commit is contained in:
parent
24d87a7eb0
commit
94f5674695
|
@ -448,7 +448,6 @@ global.getOpenUrls = function () {
|
||||||
return openUrls;
|
return openUrls;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// use '<UserData>/CachedData'-directory to store
|
// use '<UserData>/CachedData'-directory to store
|
||||||
// node/v8 cached data.
|
// node/v8 cached data.
|
||||||
let nodeCachedDataDir = getNodeCachedDataDir().then(function (value) {
|
let nodeCachedDataDir = getNodeCachedDataDir().then(function (value) {
|
||||||
|
|
2
src/typings/electron.d.ts
vendored
2
src/typings/electron.d.ts
vendored
|
@ -507,7 +507,7 @@ declare namespace Electron {
|
||||||
* and macOS, icons depend on the application associated with file mime type.
|
* and macOS, icons depend on the application associated with file mime type.
|
||||||
*/
|
*/
|
||||||
getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void;
|
getFileIcon(path: string, callback: (error: Error, icon: NativeImage) => void): void;
|
||||||
getGpuFeatureStatus(): GPUFeatureStatus;
|
getGPUFeatureStatus(): GPUFeatureStatus;
|
||||||
getJumpListSettings(): JumpListSettings;
|
getJumpListSettings(): JumpListSettings;
|
||||||
/**
|
/**
|
||||||
* Note: When distributing your packaged app, you have to also ship the locales
|
* Note: When distributing your packaged app, you have to also ship the locales
|
||||||
|
|
|
@ -381,7 +381,7 @@ export interface IQueuedSender {
|
||||||
// queue is free again to consume messages.
|
// queue is free again to consume messages.
|
||||||
// On Windows we always wait for the send() method to return before sending the next message
|
// On Windows we always wait for the send() method to return before sending the next message
|
||||||
// to workaround https://github.com/nodejs/node/issues/7657 (IPC can freeze process)
|
// to workaround https://github.com/nodejs/node/issues/7657 (IPC can freeze process)
|
||||||
export function createQueuedSender(childProcess: cp.ChildProcess | NodeJS.Process): IQueuedSender {
|
export function createQueuedSender(childProcess: cp.ChildProcess): IQueuedSender {
|
||||||
let msgQueue: string[] = [];
|
let msgQueue: string[] = [];
|
||||||
let useQueue = false;
|
let useQueue = false;
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ export function request(options: IRequestOptions): TPromise<IRequestContext> {
|
||||||
stream = stream.pipe(createGunzip());
|
stream = stream.pipe(createGunzip());
|
||||||
}
|
}
|
||||||
|
|
||||||
c({ res, stream });
|
c({ res, stream } as IRequestContext);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ suite('Arrays', () => {
|
||||||
for (let i = 1; i < array.length; i++) {
|
for (let i = 1; i < array.length; i++) {
|
||||||
let n = array[i];
|
let n = array[i];
|
||||||
if (last > n) {
|
if (last > n) {
|
||||||
assert.fail(array.slice(i - 10, i + 10));
|
assert.fail(JSON.stringify(array.slice(i - 10, i + 10)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ suite('Cache', () => {
|
||||||
const cache = new Cache(() => TPromise.as(counter++));
|
const cache = new Cache(() => TPromise.as(counter++));
|
||||||
|
|
||||||
return cache.get()
|
return cache.get()
|
||||||
.then(c => assert.equal(c, 0), () => assert.fail())
|
.then(c => assert.equal(c, 0), () => assert.fail('Unexpected assertion error'))
|
||||||
.then(() => cache.get())
|
.then(() => cache.get())
|
||||||
.then(c => assert.equal(c, 0), () => assert.fail());
|
.then(c => assert.equal(c, 0), () => assert.fail('Unexpected assertion error'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('simple error', () => {
|
test('simple error', () => {
|
||||||
|
@ -26,9 +26,9 @@ suite('Cache', () => {
|
||||||
const cache = new Cache(() => TPromise.wrapError(new Error(String(counter++))));
|
const cache = new Cache(() => TPromise.wrapError(new Error(String(counter++))));
|
||||||
|
|
||||||
return cache.get()
|
return cache.get()
|
||||||
.then(() => assert.fail(), err => assert.equal(err.message, 0))
|
.then(() => assert.fail('Unexpected assertion error'), err => assert.equal(err.message, 0))
|
||||||
.then(() => cache.get())
|
.then(() => cache.get())
|
||||||
.then(() => assert.fail(), err => assert.equal(err.message, 0));
|
.then(() => assert.fail('Unexpected assertion error'), err => assert.equal(err.message, 0));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should retry cancellations', () => {
|
test('should retry cancellations', () => {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import * as processes from 'vs/base/node/processes';
|
import * as processes from 'vs/base/node/processes';
|
||||||
|
|
||||||
const sender = processes.createQueuedSender(process);
|
const sender = processes.createQueuedSender(<any>process);
|
||||||
|
|
||||||
process.on('message', msg => {
|
process.on('message', msg => {
|
||||||
sender.send(msg);
|
sender.send(msg);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import * as processes from 'vs/base/node/processes';
|
import * as processes from 'vs/base/node/processes';
|
||||||
|
|
||||||
const sender = processes.createQueuedSender(process);
|
const sender = processes.createQueuedSender(<any>process);
|
||||||
|
|
||||||
process.on('message', msg => {
|
process.on('message', msg => {
|
||||||
sender.send(msg);
|
sender.send(msg);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { app, ipcMain as ipc, BrowserWindow } from 'electron';
|
import { app, ipcMain as ipc } from 'electron';
|
||||||
import * as platform from 'vs/base/common/platform';
|
import * as platform from 'vs/base/common/platform';
|
||||||
import { WindowsManager } from 'vs/code/electron-main/windows';
|
import { WindowsManager } from 'vs/code/electron-main/windows';
|
||||||
import { IWindowsService, OpenContext, ActiveWindowManager } from 'vs/platform/windows/common/windows';
|
import { IWindowsService, OpenContext, ActiveWindowManager } from 'vs/platform/windows/common/windows';
|
||||||
|
@ -127,7 +127,7 @@ export class CodeApplication {
|
||||||
return srcUri.startsWith(URI.file(this.environmentService.appRoot.toLowerCase()).toString());
|
return srcUri.startsWith(URI.file(this.environmentService.appRoot.toLowerCase()).toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
app.on('web-contents-created', (_event: any, contents) => {
|
app.on('web-contents-created', (event: any, contents) => {
|
||||||
contents.on('will-attach-webview', (event: Electron.Event, webPreferences, params) => {
|
contents.on('will-attach-webview', (event: Electron.Event, webPreferences, params) => {
|
||||||
delete webPreferences.preload;
|
delete webPreferences.preload;
|
||||||
webPreferences.nodeIntegration = false;
|
webPreferences.nodeIntegration = false;
|
||||||
|
@ -182,15 +182,15 @@ export class CodeApplication {
|
||||||
this.windowsMainService.openNewWindow(OpenContext.DESKTOP); //macOS native tab "+" button
|
this.windowsMainService.openNewWindow(OpenContext.DESKTOP); //macOS native tab "+" button
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('vscode:exit', (_event: any, code: number) => {
|
ipc.on('vscode:exit', (event: any, code: number) => {
|
||||||
this.logService.trace('IPC#vscode:exit', code);
|
this.logService.trace('IPC#vscode:exit', code);
|
||||||
|
|
||||||
this.dispose();
|
this.dispose();
|
||||||
this.lifecycleService.kill(code);
|
this.lifecycleService.kill(code);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('vscode:fetchShellEnv', (_event: any, windowId: number) => {
|
ipc.on('vscode:fetchShellEnv', event => {
|
||||||
const { webContents } = BrowserWindow.fromId(windowId);
|
const webContents = event.sender.webContents;
|
||||||
getShellEnvironment().then(shellEnv => {
|
getShellEnvironment().then(shellEnv => {
|
||||||
if (!webContents.isDestroyed()) {
|
if (!webContents.isDestroyed()) {
|
||||||
webContents.send('vscode:acceptShellEnv', shellEnv);
|
webContents.send('vscode:acceptShellEnv', shellEnv);
|
||||||
|
@ -204,7 +204,7 @@ export class CodeApplication {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('vscode:broadcast', (_event: any, windowId: number, broadcast: { channel: string; payload: any; }) => {
|
ipc.on('vscode:broadcast', (event: any, windowId: number, broadcast: { channel: string; payload: any; }) => {
|
||||||
if (this.windowsMainService && broadcast.channel && !isUndefinedOrNull(broadcast.payload)) {
|
if (this.windowsMainService && broadcast.channel && !isUndefinedOrNull(broadcast.payload)) {
|
||||||
this.logService.trace('IPC#vscode:broadcast', broadcast.channel, broadcast.payload);
|
this.logService.trace('IPC#vscode:broadcast', broadcast.channel, broadcast.payload);
|
||||||
|
|
||||||
|
@ -402,11 +402,12 @@ export class CodeApplication {
|
||||||
this.windowsMainService.ready(this.userEnv);
|
this.windowsMainService.ready(this.userEnv);
|
||||||
|
|
||||||
// Open our first window
|
// Open our first window
|
||||||
|
const macOpenFiles = (<any>global).macOpenFiles as string[];
|
||||||
const context = !!process.env['VSCODE_CLI'] ? OpenContext.CLI : OpenContext.DESKTOP;
|
const context = !!process.env['VSCODE_CLI'] ? OpenContext.CLI : OpenContext.DESKTOP;
|
||||||
if (args['new-window'] && args._.length === 0) {
|
if (args['new-window'] && args._.length === 0) {
|
||||||
this.windowsMainService.open({ context, cli: args, forceNewWindow: true, forceEmpty: true, initialStartup: true }); // new window if "-n" was used without paths
|
this.windowsMainService.open({ context, cli: args, forceNewWindow: true, forceEmpty: true, initialStartup: true }); // new window if "-n" was used without paths
|
||||||
} else if (global.macOpenFiles && global.macOpenFiles.length && (!args._ || !args._.length)) {
|
} else if (macOpenFiles && macOpenFiles.length && (!args._ || !args._.length)) {
|
||||||
this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, pathsToOpen: global.macOpenFiles, initialStartup: true }); // mac: open-file event received on startup
|
this.windowsMainService.open({ context: OpenContext.DOCK, cli: args, pathsToOpen: macOpenFiles, initialStartup: true }); // mac: open-file event received on startup
|
||||||
} else {
|
} else {
|
||||||
this.windowsMainService.open({ context, cli: args, forceNewWindow: args['new-window'] || (!args._.length && args['unity-launch']), diffMode: args.diff, initialStartup: true }); // default: read paths from cli
|
this.windowsMainService.open({ context, cli: args, forceNewWindow: args['new-window'] || (!args._.length && args['unity-launch']), diffMode: args.diff, initialStartup: true }); // default: read paths from cli
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ export class CodeMenu {
|
||||||
this.windowsMainService.onWindowClose(() => this.updateWorkspaceMenuItems());
|
this.windowsMainService.onWindowClose(() => this.updateWorkspaceMenuItems());
|
||||||
|
|
||||||
// Listen to extension viewlets
|
// Listen to extension viewlets
|
||||||
ipc.on('vscode:extensionViewlets', (_event: any, rawExtensionViewlets: string) => {
|
ipc.on('vscode:extensionViewlets', (event: any, rawExtensionViewlets: string) => {
|
||||||
let extensionViewlets: IExtensionViewlet[] = [];
|
let extensionViewlets: IExtensionViewlet[] = [];
|
||||||
try {
|
try {
|
||||||
extensionViewlets = JSON.parse(rawExtensionViewlets);
|
extensionViewlets = JSON.parse(rawExtensionViewlets);
|
||||||
|
|
|
@ -606,7 +606,7 @@ export class CodeWindow implements ICodeWindow {
|
||||||
|
|
||||||
// Perf Counters
|
// Perf Counters
|
||||||
windowConfiguration.perfEntries = exportEntries();
|
windowConfiguration.perfEntries = exportEntries();
|
||||||
windowConfiguration.perfStartTime = global.perfStartTime;
|
windowConfiguration.perfStartTime = (<any>global).perfStartTime;
|
||||||
windowConfiguration.perfWindowLoadTime = Date.now();
|
windowConfiguration.perfWindowLoadTime = Date.now();
|
||||||
|
|
||||||
// Config (combination of process.argv and window configuration)
|
// Config (combination of process.argv and window configuration)
|
||||||
|
|
|
@ -169,7 +169,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||||
});
|
});
|
||||||
|
|
||||||
// React to workbench loaded events from windows
|
// React to workbench loaded events from windows
|
||||||
ipc.on('vscode:workbenchLoaded', (_event: any, windowId: number) => {
|
ipc.on('vscode:workbenchLoaded', (event: any, windowId: number) => {
|
||||||
this.logService.trace('IPC#vscode-workbenchLoaded');
|
this.logService.trace('IPC#vscode-workbenchLoaded');
|
||||||
|
|
||||||
const win = this.getWindowById(windowId);
|
const win = this.getWindowById(windowId);
|
||||||
|
|
|
@ -192,7 +192,7 @@ export default class RenameInputField implements IContentWidget, IDisposable {
|
||||||
this._inputField.setSelectionRange(
|
this._inputField.setSelectionRange(
|
||||||
parseInt(this._inputField.getAttribute('selectionStart')),
|
parseInt(this._inputField.getAttribute('selectionStart')),
|
||||||
parseInt(this._inputField.getAttribute('selectionEnd')));
|
parseInt(this._inputField.getAttribute('selectionEnd')));
|
||||||
}, 25);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _hide(): void {
|
private _hide(): void {
|
||||||
|
|
|
@ -109,7 +109,7 @@ suite('Editor Model - Model', () => {
|
||||||
let e: ModelRawContentChangedEvent = null;
|
let e: ModelRawContentChangedEvent = null;
|
||||||
thisModel.onDidChangeRawContent((_e) => {
|
thisModel.onDidChangeRawContent((_e) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
assert.fail();
|
assert.fail('Unexpected assertion error');
|
||||||
}
|
}
|
||||||
e = _e;
|
e = _e;
|
||||||
});
|
});
|
||||||
|
@ -128,7 +128,7 @@ suite('Editor Model - Model', () => {
|
||||||
let e: ModelRawContentChangedEvent = null;
|
let e: ModelRawContentChangedEvent = null;
|
||||||
thisModel.onDidChangeRawContent((_e) => {
|
thisModel.onDidChangeRawContent((_e) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
assert.fail();
|
assert.fail('Unexpected assertion error');
|
||||||
}
|
}
|
||||||
e = _e;
|
e = _e;
|
||||||
});
|
});
|
||||||
|
@ -205,7 +205,7 @@ suite('Editor Model - Model', () => {
|
||||||
let e: ModelRawContentChangedEvent = null;
|
let e: ModelRawContentChangedEvent = null;
|
||||||
thisModel.onDidChangeRawContent((_e) => {
|
thisModel.onDidChangeRawContent((_e) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
assert.fail();
|
assert.fail('Unexpected assertion error');
|
||||||
}
|
}
|
||||||
e = _e;
|
e = _e;
|
||||||
});
|
});
|
||||||
|
@ -224,7 +224,7 @@ suite('Editor Model - Model', () => {
|
||||||
let e: ModelRawContentChangedEvent = null;
|
let e: ModelRawContentChangedEvent = null;
|
||||||
thisModel.onDidChangeRawContent((_e) => {
|
thisModel.onDidChangeRawContent((_e) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
assert.fail();
|
assert.fail('Unexpected assertion error');
|
||||||
}
|
}
|
||||||
e = _e;
|
e = _e;
|
||||||
});
|
});
|
||||||
|
@ -243,7 +243,7 @@ suite('Editor Model - Model', () => {
|
||||||
let e: ModelRawContentChangedEvent = null;
|
let e: ModelRawContentChangedEvent = null;
|
||||||
thisModel.onDidChangeRawContent((_e) => {
|
thisModel.onDidChangeRawContent((_e) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
assert.fail();
|
assert.fail('Unexpected assertion error');
|
||||||
}
|
}
|
||||||
e = _e;
|
e = _e;
|
||||||
});
|
});
|
||||||
|
@ -263,7 +263,7 @@ suite('Editor Model - Model', () => {
|
||||||
let e: ModelRawContentChangedEvent = null;
|
let e: ModelRawContentChangedEvent = null;
|
||||||
thisModel.onDidChangeRawContent((_e) => {
|
thisModel.onDidChangeRawContent((_e) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
assert.fail();
|
assert.fail('Unexpected assertion error');
|
||||||
}
|
}
|
||||||
e = _e;
|
e = _e;
|
||||||
});
|
});
|
||||||
|
@ -314,7 +314,7 @@ suite('Editor Model - Model', () => {
|
||||||
let e: ModelRawContentChangedEvent = null;
|
let e: ModelRawContentChangedEvent = null;
|
||||||
thisModel.onDidChangeRawContent((_e) => {
|
thisModel.onDidChangeRawContent((_e) => {
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
assert.fail();
|
assert.fail('Unexpected assertion error');
|
||||||
}
|
}
|
||||||
e = _e;
|
e = _e;
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,7 +32,7 @@ export class ElectronURLListener {
|
||||||
@IURLService private urlService: IURLService,
|
@IURLService private urlService: IURLService,
|
||||||
@IWindowsMainService private windowsService: IWindowsMainService
|
@IWindowsMainService private windowsService: IWindowsMainService
|
||||||
) {
|
) {
|
||||||
const globalBuffer = (global.getOpenUrls() || []) as string[];
|
const globalBuffer = ((<any>global).getOpenUrls() || []) as string[];
|
||||||
const rawBuffer = [
|
const rawBuffer = [
|
||||||
...(typeof initial === 'string' ? [initial] : initial),
|
...(typeof initial === 'string' ? [initial] : initial),
|
||||||
...globalBuffer
|
...globalBuffer
|
||||||
|
|
|
@ -28,7 +28,7 @@ process.lazyEnv = new Promise(function (resolve) {
|
||||||
assign(process.env, shellEnv);
|
assign(process.env, shellEnv);
|
||||||
resolve(process.env);
|
resolve(process.env);
|
||||||
});
|
});
|
||||||
ipc.send('vscode:fetchShellEnv', remote.getCurrentWindow().id);
|
ipc.send('vscode:fetchShellEnv');
|
||||||
});
|
});
|
||||||
|
|
||||||
Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
|
Error.stackTraceLimit = 100; // increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
|
||||||
|
|
|
@ -131,7 +131,7 @@ export class ElectronWindow extends Themable {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Support runAction event
|
// Support runAction event
|
||||||
ipc.on('vscode:runAction', (_event: any, request: IRunActionInWindowRequest) => {
|
ipc.on('vscode:runAction', (event: any, request: IRunActionInWindowRequest) => {
|
||||||
const args: any[] = [];
|
const args: any[] = [];
|
||||||
|
|
||||||
// If we run an action from the touchbar, we fill in the currently active resource
|
// If we run an action from the touchbar, we fill in the currently active resource
|
||||||
|
@ -162,7 +162,7 @@ export class ElectronWindow extends Themable {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Support resolve keybindings event
|
// Support resolve keybindings event
|
||||||
ipc.on('vscode:resolveKeybindings', (_event: any, rawActionIds: string) => {
|
ipc.on('vscode:resolveKeybindings', (event: any, rawActionIds: string) => {
|
||||||
let actionIds: string[] = [];
|
let actionIds: string[] = [];
|
||||||
try {
|
try {
|
||||||
actionIds = JSON.parse(rawActionIds);
|
actionIds = JSON.parse(rawActionIds);
|
||||||
|
@ -178,7 +178,7 @@ export class ElectronWindow extends Themable {
|
||||||
}, () => errors.onUnexpectedError);
|
}, () => errors.onUnexpectedError);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.on('vscode:reportError', (_event: any, error: string) => {
|
ipc.on('vscode:reportError', (event: any, error: string) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
const errorParsed = JSON.parse(error);
|
const errorParsed = JSON.parse(error);
|
||||||
errorParsed.mainProcess = true;
|
errorParsed.mainProcess = true;
|
||||||
|
@ -187,13 +187,13 @@ export class ElectronWindow extends Themable {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Support openFiles event for existing and new files
|
// Support openFiles event for existing and new files
|
||||||
ipc.on('vscode:openFiles', (_event: any, request: IOpenFileRequest) => this.onOpenFiles(request));
|
ipc.on('vscode:openFiles', (event: any, request: IOpenFileRequest) => this.onOpenFiles(request));
|
||||||
|
|
||||||
// Support addFolders event if we have a workspace opened
|
// Support addFolders event if we have a workspace opened
|
||||||
ipc.on('vscode:addFolders', (_event: any, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
ipc.on('vscode:addFolders', (event: any, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
||||||
|
|
||||||
// Message support
|
// Message support
|
||||||
ipc.on('vscode:showInfoMessage', (_event: any, message: string) => {
|
ipc.on('vscode:showInfoMessage', (event: any, message: string) => {
|
||||||
this.notificationService.info(message);
|
this.notificationService.info(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ export class ElectronWindow extends Themable {
|
||||||
});
|
});
|
||||||
|
|
||||||
// keyboard layout changed event
|
// keyboard layout changed event
|
||||||
ipc.on('vscode:accessibilitySupportChanged', (_event: any, accessibilitySupportEnabled: boolean) => {
|
ipc.on('vscode:accessibilitySupportChanged', (event: any, accessibilitySupportEnabled: boolean) => {
|
||||||
browser.setAccessibilitySupport(accessibilitySupportEnabled ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled);
|
browser.setAccessibilitySupport(accessibilitySupportEnabled ? AccessibilitySupport.Enabled : AccessibilitySupport.Disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
|
||||||
|
|
||||||
// const nativeExit = process.exit.bind(process);
|
// const nativeExit = process.exit.bind(process);
|
||||||
function patchProcess(allowExit: boolean) {
|
function patchProcess(allowExit: boolean) {
|
||||||
process.exit = function (code) {
|
process.exit = function (code?: number) {
|
||||||
if (allowExit) {
|
if (allowExit) {
|
||||||
exit(code);
|
exit(code);
|
||||||
} else {
|
} else {
|
||||||
const err = new Error('An extension called process.exit() and this was prevented.');
|
const err = new Error('An extension called process.exit() and this was prevented.');
|
||||||
console.warn(err.stack);
|
console.warn(err.stack);
|
||||||
}
|
}
|
||||||
};
|
} as (code?: number) => never;
|
||||||
|
|
||||||
process.crash = function () {
|
process.crash = function () {
|
||||||
const err = new Error('An extension called process.crash() and this was prevented.');
|
const err = new Error('An extension called process.crash() and this was prevented.');
|
||||||
|
|
|
@ -55,12 +55,12 @@ export class NodeCachedDataManager implements IWorkbenchContribution {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
this._telemetryService.publicLog('cachedDataInfo', {
|
this._telemetryService.publicLog('cachedDataInfo', {
|
||||||
didRequestCachedData: Boolean(global.require.getConfig().nodeCachedDataDir),
|
didRequestCachedData: Boolean((<any>global).require.getConfig().nodeCachedDataDir),
|
||||||
didRejectCachedData,
|
didRejectCachedData,
|
||||||
didProduceCachedData
|
didProduceCachedData
|
||||||
});
|
});
|
||||||
|
|
||||||
global.require.config({ onNodeCachedData: undefined });
|
(<any>global).require.config({ onNodeCachedData: undefined });
|
||||||
delete MonacoEnvironment.onNodeCachedData;
|
delete MonacoEnvironment.onNodeCachedData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,6 @@ suite('Debug - Adapter', () => {
|
||||||
|
|
||||||
return adapter.getInitialConfigurationContent().then(content => {
|
return adapter.getInitialConfigurationContent().then(content => {
|
||||||
assert.equal(content, expected);
|
assert.equal(content, expected);
|
||||||
}, err => assert.fail());
|
}, err => assert.fail(err));
|
||||||
});
|
});
|
||||||
});
|
});
|
|
@ -24,7 +24,7 @@ var cols = process.env.PTYCOLS;
|
||||||
var rows = process.env.PTYROWS;
|
var rows = process.env.PTYROWS;
|
||||||
var currentTitle = '';
|
var currentTitle = '';
|
||||||
|
|
||||||
setupPlanB(process.env.PTYPID);
|
setupPlanB(Number(process.env.PTYPID));
|
||||||
cleanEnv();
|
cleanEnv();
|
||||||
|
|
||||||
interface IOptions {
|
interface IOptions {
|
||||||
|
@ -91,9 +91,9 @@ process.on('message', function (message) {
|
||||||
sendProcessId();
|
sendProcessId();
|
||||||
setupTitlePolling();
|
setupTitlePolling();
|
||||||
|
|
||||||
function getArgs() {
|
function getArgs(): string[] {
|
||||||
if (process.env['PTYSHELLCMDLINE']) {
|
if (process.env['PTYSHELLCMDLINE']) {
|
||||||
return process.env['PTYSHELLCMDLINE'];
|
return [process.env['PTYSHELLCMDLINE']];
|
||||||
}
|
}
|
||||||
var args = [];
|
var args = [];
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
|
@ -119,7 +119,7 @@ export class CrashReporterService implements ICrashReporterService {
|
||||||
// Experimental crash reporting support for child processes on Mac only for now
|
// Experimental crash reporting support for child processes on Mac only for now
|
||||||
if (this.isEnabled && isMacintosh) {
|
if (this.isEnabled && isMacintosh) {
|
||||||
const childProcessOptions = deepClone(this.options);
|
const childProcessOptions = deepClone(this.options);
|
||||||
childProcessOptions.extra.processName = name;
|
(<any>childProcessOptions.extra).processName = name;
|
||||||
childProcessOptions.crashesDirectory = os.tmpdir();
|
childProcessOptions.crashesDirectory = os.tmpdir();
|
||||||
|
|
||||||
return childProcessOptions;
|
return childProcessOptions;
|
||||||
|
|
|
@ -61,7 +61,7 @@ export class NsfwWatcherService implements IWatcherService {
|
||||||
ignored: request.ignored
|
ignored: request.ignored
|
||||||
};
|
};
|
||||||
|
|
||||||
process.on('uncaughtException', e => {
|
process.on('uncaughtException', (e: Error | string) => {
|
||||||
|
|
||||||
// Specially handle ENOSPC errors that can happen when
|
// Specially handle ENOSPC errors that can happen when
|
||||||
// the watcher consumes so many file descriptors that
|
// the watcher consumes so many file descriptors that
|
||||||
|
|
|
@ -29,7 +29,7 @@ const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.u
|
||||||
export class RipgrepEngine {
|
export class RipgrepEngine {
|
||||||
private isDone = false;
|
private isDone = false;
|
||||||
private rgProc: cp.ChildProcess;
|
private rgProc: cp.ChildProcess;
|
||||||
private killRgProcFn: Function;
|
private killRgProcFn: (code?: number) => void;
|
||||||
private postProcessExclusions: glob.ParsedExpression;
|
private postProcessExclusions: glob.ParsedExpression;
|
||||||
|
|
||||||
private ripgrepParser: RipgrepParser;
|
private ripgrepParser: RipgrepParser;
|
||||||
|
|
|
@ -109,7 +109,7 @@ suite('SearchService', () => {
|
||||||
assert.deepStrictEqual(value, match);
|
assert.deepStrictEqual(value, match);
|
||||||
results++;
|
results++;
|
||||||
} else {
|
} else {
|
||||||
assert.fail(value);
|
assert.fail(JSON.stringify(value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -131,7 +131,7 @@ suite('SearchService', () => {
|
||||||
});
|
});
|
||||||
results.push(value.length);
|
results.push(value.length);
|
||||||
} else {
|
} else {
|
||||||
assert.fail(value);
|
assert.fail(JSON.stringify(value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -218,7 +218,7 @@ suite('SearchService', () => {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
results.push(...value.map(v => v.path));
|
results.push(...value.map(v => v.path));
|
||||||
} else {
|
} else {
|
||||||
assert.fail(value);
|
assert.fail(JSON.stringify(value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -245,7 +245,7 @@ suite('SearchService', () => {
|
||||||
});
|
});
|
||||||
results.push(value.length);
|
results.push(value.length);
|
||||||
} else {
|
} else {
|
||||||
assert.fail(value);
|
assert.fail(JSON.stringify(value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -275,7 +275,7 @@ suite('SearchService', () => {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
results.push(...value.map(v => v.path));
|
results.push(...value.map(v => v.path));
|
||||||
} else {
|
} else {
|
||||||
assert.fail(value);
|
assert.fail(JSON.stringify(value));
|
||||||
}
|
}
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const results = [];
|
const results = [];
|
||||||
|
@ -291,7 +291,7 @@ suite('SearchService', () => {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
results.push(...value.map(v => v.path));
|
results.push(...value.map(v => v.path));
|
||||||
} else {
|
} else {
|
||||||
assert.fail(value);
|
assert.fail(JSON.stringify(value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
@ -316,7 +316,7 @@ suite('SearchService', () => {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
results.push(...value.map(v => v.path));
|
results.push(...value.map(v => v.path));
|
||||||
} else {
|
} else {
|
||||||
assert.fail(value);
|
assert.fail(JSON.stringify(value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue