fix: couldn't start on linux
Massimo Melina committed
Mar 14, 2022 at 22:29 UTC
2aac61964d213528cc2d61386253124362a5216a
1 file changed
+3
-1
server/src/listen.ts
+3
-1
@@ -8,7 +8,7 @@ import { watchLoad } from './watchLoad'
8
import { networkInterfaces } from 'os';
9
import { newConnection } from './connections'
10
import open from 'open'
11
-import { prefix } from './misc'
11
+import { prefix, wait } from './misc'
12
import { ADMIN_URI, DEV } from './const'
13
import findProcess from 'find-process'
14
import _ from 'lodash'
@@ -18,6 +18,8 @@ let httpSrv: http.Server & ServerExtra
18
let httpsSrv: http.Server & ServerExtra
19
20
subscribeConfig<number>({ k:'port', defaultValue: 80 }, async port => {
21
+ while (!app)
22
+ await wait(100)
23
stopServer(httpSrv).then()
24
httpSrv = http.createServer(app.callback())
25
port = await startServer(httpSrv, { port, name:'http' })