fix: error creating sock file on windows
This commit is contained in:
parent
3d0192d367
commit
6567013440
@ -13,7 +13,6 @@ import { resolve } from 'path';
|
||||
import qs from 'qs';
|
||||
import handler from 'serve-handler';
|
||||
import { parse } from 'url';
|
||||
import xpipe from 'xpipe';
|
||||
import { AppSupervisor } from '../app-supervisor';
|
||||
import { ApplicationOptions } from '../application';
|
||||
import { getPackageDirByExposeUrl, getPackageNameByExposeUrl, PLUGIN_STATICS_PATH } from '../plugin-manager';
|
||||
@ -59,7 +58,7 @@ export class Gateway extends EventEmitter {
|
||||
private port: number = process.env.APP_PORT ? parseInt(process.env.APP_PORT) : null;
|
||||
private host = '0.0.0.0';
|
||||
private wsServer: WSServer;
|
||||
private socketPath = xpipe.eq(resolve(process.cwd(), 'storage', 'gateway.sock'));
|
||||
private socketPath = resolve(process.cwd(), 'storage', 'gateway.sock');
|
||||
|
||||
loggers = new Registry<SystemLogger>();
|
||||
|
||||
@ -67,7 +66,7 @@ export class Gateway extends EventEmitter {
|
||||
super();
|
||||
this.reset();
|
||||
if (process.env.SOCKET_PATH) {
|
||||
this.socketPath = xpipe.eq(resolve(process.cwd(), process.env.SOCKET_PATH));
|
||||
this.socketPath = resolve(process.cwd(), process.env.SOCKET_PATH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import net from 'net';
|
||||
import * as events from 'events';
|
||||
import xpipe from 'xpipe';
|
||||
import { Logger, createConsoleLogger } from '@nocobase/logger';
|
||||
|
||||
export const writeJSON = (socket: net.Socket, data: object) => {
|
||||
@ -34,7 +35,7 @@ export class IPCSocketClient extends events.EventEmitter {
|
||||
|
||||
static async getConnection(serverPath: string) {
|
||||
return new Promise<IPCSocketClient>((resolve, reject) => {
|
||||
const client = net.createConnection({ path: serverPath }, () => {
|
||||
const client = net.createConnection({ path: xpipe.eq(serverPath) }, () => {
|
||||
// 'connect' listener.
|
||||
resolve(new IPCSocketClient(client));
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import net from 'net';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import xpipe from 'xpipe';
|
||||
import { AppSupervisor } from '../app-supervisor';
|
||||
import { writeJSON } from './ipc-socket-client';
|
||||
import { randomUUID } from 'crypto';
|
||||
@ -64,7 +65,7 @@ export class IPCSocketServer {
|
||||
});
|
||||
});
|
||||
|
||||
socketServer.listen(socketPath, () => {
|
||||
socketServer.listen(xpipe.eq(socketPath), () => {
|
||||
console.log(`Gateway IPC Server running at ${socketPath}`);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user