ptyHostMain.ts 1.4 KB
Newer Older
D
Daniel Imms 已提交
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import { Server } from 'vs/base/parts/ipc/node/ipc.cp';
import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc';
8
import { PtyService } from 'vs/platform/terminal/node/ptyService';
9
import { TerminalIpcChannels } from 'vs/platform/terminal/common/terminal';
D
Daniel Imms 已提交
10 11
import { ConsoleLogger, LogService } from 'vs/platform/log/common/log';
import { LogLevelChannel } from 'vs/platform/log/common/logIpc';
12
import { HeartbeatService } from 'vs/platform/terminal/node/heartbeatService';
D
Daniel Imms 已提交
13 14

const server = new Server('ptyHost');
D
Daniel Imms 已提交
15 16 17 18 19

const logService = new LogService(new ConsoleLogger());
const logChannel = new LogLevelChannel(logService);
server.registerChannel(TerminalIpcChannels.Log, logChannel);

20 21 22 23 24
const heartbeatService = new HeartbeatService();
server.registerChannel(TerminalIpcChannels.Heartbeat, ProxyChannel.fromService(heartbeatService));

const ptyService = new PtyService(logService);
server.registerChannel(TerminalIpcChannels.PtyHost, ProxyChannel.fromService(ptyService));
25 26 27

process.once('exit', () => {
	logService.dispose();
28 29
	heartbeatService.dispose();
	ptyService.dispose();
30
});