-
Notifications
You must be signed in to change notification settings - Fork 29.3k
/
watcherMain.ts
20 lines (17 loc) · 1 KB
/
watcherMain.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc';
import { Server as ChildProcessServer } from 'vs/base/parts/ipc/node/ipc.cp';
import { Server as UtilityProcessServer } from 'vs/base/parts/ipc/node/ipc.mp';
import { isUtilityProcess } from 'vs/base/parts/sandbox/node/electronTypes';
import { UniversalWatcher } from 'vs/platform/files/node/watcher/watcher';
let server: ChildProcessServer<string> | UtilityProcessServer;
if (isUtilityProcess(process)) {
server = new UtilityProcessServer();
} else {
server = new ChildProcessServer('watcher');
}
const service = new UniversalWatcher();
server.registerChannel('watcher', ProxyChannel.fromService(service));