Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: avoid port collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Sep 10, 2018
1 parent 308a128 commit 7de5188
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/electron/start-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function startApp(ctx: AppContext): Promise<{ emitter: Events.Event

// Cast getPort return type from PromiseLike<number> to Promise<number>
// to avoid async-promise tslint rule to produce errors here
ctx.port = await (getPort({ port: 1879 }) as Promise<number>);
ctx.port = await (getPort({ port: ctx.port }) as Promise<number>);

const sender = new Sender();
const server = createServer({ port: ctx.port, sender });
Expand Down Expand Up @@ -68,7 +68,7 @@ export async function startApp(ctx: AppContext): Promise<{ emitter: Events.Event
log.info(`Server started on port ${ctx.port}.`);

if (ctx.win) {
ctx.win.reload();
ctx.win.loadURL(`http://localhost:${ctx.port}/`);
} else {
ctx.win = (await createWindow({ port: ctx.port as number })).window;
}
Expand Down

0 comments on commit 7de5188

Please sign in to comment.