Skip to content

Commit

Permalink
server: export start promise to wait for https server
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 19, 2023
1 parent 35b5cdd commit 877e1d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions server/src/scrypted-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ process.env['NODE_OPTIONS'] = '--dns-result-order=ipv4first';

startPeriodicGarbageCollection();

let startPromise: any;

if (process.argv[2] === 'child' || process.argv[2] === 'child-thread') {
// plugins should never crash. this handler will be removed, and then readded
// after the plugin source map is retrieved.
Expand All @@ -33,7 +35,7 @@ if (process.argv[2] === 'child' || process.argv[2] === 'child-thread') {
});

const start = require('./scrypted-plugin-main').default;
start(__filename);
startPromise = start(__filename);
}
else {
// unhandled rejections are allowed if they are from a rpc/plugin call.
Expand All @@ -46,5 +48,7 @@ else {
});

const start = require('./scrypted-server-main').default;
start(__filename);
startPromise = start(__filename);
}

export default startPromise;

0 comments on commit 877e1d4

Please sign in to comment.