mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
Introduce Remote Terminals
Co-authored-by: Rob Lourens <roblourens@gmail.com>
This commit is contained in:
@@ -34,12 +34,18 @@ export interface RunCommandPipeArgs {
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export class CLIServer {
|
||||
export interface ICommandsExecuter {
|
||||
executeCommand<T>(id: string, ...args: any[]): Promise<T>;
|
||||
}
|
||||
|
||||
private _server: http.Server;
|
||||
private _ipcHandlePath: string | undefined;
|
||||
export class CLIServerBase {
|
||||
private readonly _server: http.Server;
|
||||
|
||||
constructor(@IExtHostCommands private _commands: IExtHostCommands, @ILogService private logService: ILogService) {
|
||||
constructor(
|
||||
private readonly _commands: ICommandsExecuter,
|
||||
private readonly logService: ILogService,
|
||||
private readonly _ipcHandlePath: string,
|
||||
) {
|
||||
this._server = http.createServer((req, res) => this.onRequest(req, res));
|
||||
this.setup().catch(err => {
|
||||
logService.error(err);
|
||||
@@ -52,8 +58,6 @@ export class CLIServer {
|
||||
}
|
||||
|
||||
private async setup(): Promise<string> {
|
||||
this._ipcHandlePath = createRandomIPCHandle();
|
||||
|
||||
try {
|
||||
this._server.listen(this.ipcHandlePath);
|
||||
this._server.on('error', err => this.logService.error(err));
|
||||
@@ -176,3 +180,12 @@ export class CLIServer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class CLIServer extends CLIServerBase {
|
||||
constructor(
|
||||
@IExtHostCommands commands: IExtHostCommands,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super(commands, logService, createRandomIPCHandle());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user