extensions/git/src/ipc/ipcServer.ts/createIPCServer
export async function createIPCServer(context?: string): Promise<IIPCServer> {
	const server = http.createServer();
	const hash = crypto.createHash('sha1');

	if (!context) {
		const buffer = await new Promise<Buffer>((c, e) => crypto.randomBytes(20, (err, buf) => err ? e(err) : c(buf)));
		hash.update(buffer);
	} else {
		hash.update(context);
	}

	const ipcHandlePath = getIPCHandlePath(hash.digest('hex').substr(0, 10));

	if (process.platform !== 'win32') {
		try {
			await fs.promises.unlink(ipcHandlePath);
		} catch {
			// noop
		}
	}

	return new Promise((c, e) => {
		try {
			server.on('error', err => e(err));
			server.listen(ipcHandlePath);
			c(new IPCServer(server, ipcHandlePath));
		} catch (err) {
			e(err);
		}
	});
}