Merge pull request #126301 from microsoft/tyriar/118276

Support detaching terminal processes manually
This commit is contained in:
Daniel Imms 2021-06-14 14:53:27 -07:00 committed by GitHub
commit 8fdf47ad6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 1 deletions

View file

@ -846,6 +846,19 @@ export function registerTerminalActions() {
accessor.get(ITerminalService).hideFindWidget();
}
});
registerAction2(class extends Action2 {
constructor() {
super({
id: TerminalCommandId.DetachProcess,
title: { value: localize('workbench.action.terminal.detachProcess', "Detach Process"), original: 'Detach Process' },
f1: true,
category
});
}
async run(accessor: ServicesAccessor) {
accessor.get(ITerminalService).doWithActiveInstance(instance => instance.detachFromProcess());
}
});
registerAction2(class extends Action2 {
constructor() {
super({

View file

@ -984,6 +984,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
detachFromProcess(): void {
this._processManager.detachFromProcess();
this.dispose();
}
forceRedraw(): void {

View file

@ -176,6 +176,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
detachFromProcess(): void {
this._process?.detach?.();
this._process = null;
}
async createProcess(

View file

@ -447,7 +447,8 @@ export const enum TerminalCommandId {
NavigationModeFocusPrevious = 'workbench.action.terminal.navigationModeFocusPrevious',
ShowEnvironmentInformation = 'workbench.action.terminal.showEnvironmentInformation',
SearchWorkspace = 'workbench.action.terminal.searchWorkspace',
AttachToRemoteTerminal = 'workbench.action.terminal.attachToSession'
AttachToRemoteTerminal = 'workbench.action.terminal.attachToSession',
DetachProcess = 'workbench.action.terminal.detachProcess'
}
export const DEFAULT_COMMANDS_TO_SKIP_SHELL: string[] = [