mirror of
https://github.com/Ryujinx/Ryujinx-Ldn-Website.git
synced 2024-12-22 13:45:37 +00:00
Fix startup crash if the specified socket already exists
This commit is contained in:
parent
b0c43b3571
commit
700e913b6a
|
@ -1,10 +1,16 @@
|
|||
import { env } from "process";
|
||||
import { app, logger } from "./app";
|
||||
import http from "http";
|
||||
import { existsSync, rmSync } from "fs";
|
||||
|
||||
const server = http.createServer(app);
|
||||
|
||||
if (process.env.SOCKET_PATH != null && process.env.SOCKET_PATH.length > 0) {
|
||||
// Remove the socket at the specified path if it already exists to avoid EADDRINUSE
|
||||
if (existsSync(process.env.SOCKET_PATH)) {
|
||||
rmSync(process.env.SOCKET_PATH);
|
||||
}
|
||||
|
||||
server.listen({
|
||||
path: process.env.SOCKET_PATH,
|
||||
readableAll: true,
|
||||
|
|
Loading…
Reference in a new issue