Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues build issues with WindowsShellHelper #33454

Merged
merged 2 commits into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ export class TerminalInstance implements ITerminalInstance {
if (platform.isWindows) {
this._processReady.then(() => {
if (!this._isDisposed) {
import('vs/workbench/parts/terminal/electron-browser/windowsShellHelper').then((module) => {
this._windowsShellHelper = new module.WindowsShellHelper(this._processId, this._shellLaunchConfig.executable, this, this._xterm);
});
this._windowsShellHelper = new WindowsShellHelper(this._processId, this._shellLaunchConfig.executable, this, this._xterm);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

import * as cp from 'child_process';
import * as platform from 'vs/base/common/platform';
import windowsProcessTree = require('windows-process-tree');
import { TPromise } from 'vs/base/common/winjs.base';
import { Emitter, debounceEvent } from 'vs/base/common/event';
import { ITerminalInstance } from 'vs/workbench/parts/terminal/common/terminal';
import { Terminal as XTermTerminal } from 'xterm';

const SHELL_EXECUTABLES = ['cmd.exe', 'powershell.exe', 'bash.exe'];

let windowsProcessTree;

export class WindowsShellHelper {
private _childProcessIdStack: number[];
private _onCheckShell: Emitter<TPromise<string>>;
Expand All @@ -29,6 +30,10 @@ export class WindowsShellHelper {
throw new Error(`WindowsShellHelper cannot be instantiated on ${platform.platform}`);
}

if (!windowsProcessTree) {
windowsProcessTree = require.__$__nodeRequire('windows-process-tree');
}

this._childProcessIdStack = [this._rootProcessId];
this._isDisposed = false;
this._onCheckShell = new Emitter<TPromise<string>>();
Expand Down