Skip to content

Commit

Permalink
fix: wait for backend to not get port unreachable
Browse files Browse the repository at this point in the history
Signed-off-by: DMaxter <[email protected]>
  • Loading branch information
DMaxter committed Feb 18, 2025
1 parent 2745ad5 commit ded8610
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1398,9 +1398,14 @@ function attachServerEventHandlers(serverProcess: ChildProcessWithoutNullStreams
}

if (isHeadlessMode) {
startServer(['-html-static-dir', path.join(process.resourcesPath, './frontend')])
.then(serverProcess => attachServerEventHandlers(serverProcess))
.then(() => shell.openExternal(`http://localhost:${defaultPort}`));
startServer(['-html-static-dir', path.join(process.resourcesPath, './frontend')]).then(
serverProcess => {
attachServerEventHandlers(serverProcess);

// Give 1s for backend to start
setTimeout(() => shell.openExternal(`http://localhost:${defaultPort}`), 1000);
}
);
} else {
startElecron();
}

0 comments on commit ded8610

Please sign in to comment.