mirror of
https://github.com/Ryujinx/Ryujinx-Ldn-Website.git
synced 2024-12-22 18:45:32 +00:00
Merge pull request #18 from TSRBerry/fix/socket-issues
Fix startup crash if the specified socket already exists
This commit is contained in:
commit
41feb2c58f
|
@ -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