提交 198dc330 编写于 作者: D Daniel Imms

Prevent multiple requests to windows-process-tree at once

For any given terminal

Fixes #33541
上级 e130c604
...@@ -17,6 +17,7 @@ export class WindowsShellHelper { ...@@ -17,6 +17,7 @@ export class WindowsShellHelper {
private _childProcessIdStack: number[]; private _childProcessIdStack: number[];
private _onCheckShell: Emitter<TPromise<string>>; private _onCheckShell: Emitter<TPromise<string>>;
private _isDisposed: boolean; private _isDisposed: boolean;
private _currentRequest: TPromise<string>;
public constructor( public constructor(
private _rootProcessId: number, private _rootProcessId: number,
...@@ -94,10 +95,17 @@ export class WindowsShellHelper { ...@@ -94,10 +95,17 @@ export class WindowsShellHelper {
if (this._isDisposed) { if (this._isDisposed) {
return TPromise.as(''); return TPromise.as('');
} }
return new TPromise<string>(resolve => { // Prevent multiple requests at once, instead return current request
if (this._currentRequest) {
return this._currentRequest;
}
this._currentRequest = new TPromise<string>(resolve => {
windowsProcessTree(this._rootProcessId, (tree) => { windowsProcessTree(this._rootProcessId, (tree) => {
resolve(this.traverseTree(tree)); const name = this.traverseTree(tree);
this._currentRequest = null;
resolve(name);
}); });
}); });
return this._currentRequest;
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册