parent
16facd8645
commit
152d4226e6
|
@ -68,6 +68,11 @@ export class RemotePty extends Disposable implements ITerminalChildProcess {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async detach(): Promise<void> {
|
||||||
|
await this._startBarrier.wait();
|
||||||
|
return this._remoteTerminalChannel.detachFromProcess(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
shutdown(immediate: boolean): void {
|
shutdown(immediate: boolean): void {
|
||||||
this._startBarrier.wait().then(_ => {
|
this._startBarrier.wait().then(_ => {
|
||||||
this._remoteTerminalChannel.shutdown(this._id, immediate);
|
this._remoteTerminalChannel.shutdown(this._id, immediate);
|
||||||
|
|
|
@ -490,7 +490,7 @@ export interface ITerminalInstance {
|
||||||
/**
|
/**
|
||||||
* Inform the process that the terminal is now detached.
|
* Inform the process that the terminal is now detached.
|
||||||
*/
|
*/
|
||||||
detachFromProcess(): void;
|
detachFromProcess(): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forces the terminal to redraw its viewport.
|
* Forces the terminal to redraw its viewport.
|
||||||
|
|
|
@ -904,7 +904,8 @@ export function registerTerminalActions() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async run(accessor: ServicesAccessor) {
|
async run(accessor: ServicesAccessor) {
|
||||||
accessor.get(ITerminalService).doWithActiveInstance(instance => instance.detachFromProcess());
|
const terminalService = accessor.get(ITerminalService);
|
||||||
|
await terminalService.getActiveInstance()?.detachFromProcess();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerAction2(class extends Action2 {
|
registerAction2(class extends Action2 {
|
||||||
|
|
|
@ -984,8 +984,8 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
detachFromProcess(): void {
|
async detachFromProcess(): Promise<void> {
|
||||||
this._processManager.detachFromProcess();
|
await this._processManager.detachFromProcess();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,8 +174,15 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
detachFromProcess(): void {
|
async detachFromProcess(): Promise<void> {
|
||||||
this._process?.detach?.();
|
if (!this._process) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this._process.detach) {
|
||||||
|
await this._process.detach();
|
||||||
|
} else {
|
||||||
|
throw new Error('This terminal process does not support detaching');
|
||||||
|
}
|
||||||
this._process = null;
|
this._process = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,9 @@ export class RemoteTerminalChannelClient {
|
||||||
attachToProcess(id: number): Promise<void> {
|
attachToProcess(id: number): Promise<void> {
|
||||||
return this._channel.call('$attachToProcess', [id]);
|
return this._channel.call('$attachToProcess', [id]);
|
||||||
}
|
}
|
||||||
|
detachFromProcess(id: number): Promise<void> {
|
||||||
|
return this._channel.call('$detachFromProcess', [id]);
|
||||||
|
}
|
||||||
listProcesses(): Promise<IProcessDetails[]> {
|
listProcesses(): Promise<IProcessDetails[]> {
|
||||||
return this._channel.call('$listProcesses');
|
return this._channel.call('$listProcesses');
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,7 +297,7 @@ export interface ITerminalProcessManager extends IDisposable {
|
||||||
readonly onEnvironmentVariableInfoChanged: Event<IEnvironmentVariableInfo>;
|
readonly onEnvironmentVariableInfoChanged: Event<IEnvironmentVariableInfo>;
|
||||||
|
|
||||||
dispose(immediate?: boolean): void;
|
dispose(immediate?: boolean): void;
|
||||||
detachFromProcess(): void;
|
detachFromProcess(): Promise<void>;
|
||||||
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean): Promise<ITerminalLaunchError | undefined>;
|
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean): Promise<ITerminalLaunchError | undefined>;
|
||||||
relaunch(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean, reset: boolean): Promise<ITerminalLaunchError | undefined>;
|
relaunch(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, isScreenReaderModeEnabled: boolean, reset: boolean): Promise<ITerminalLaunchError | undefined>;
|
||||||
write(data: string): void;
|
write(data: string): void;
|
||||||
|
|
Loading…
Reference in a new issue