mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
25 lines
707 B
TypeScript
25 lines
707 B
TypeScript
import process from 'process';
|
|
import semver from 'semver';
|
|
import { RPCResultError, startPeriodicGarbageCollection } from './rpc';
|
|
import { PluginError } from './plugin/plugin-error';
|
|
|
|
if (!semver.gte(process.version, '16.0.0')) {
|
|
throw new Error('"node" version out of date. Please update node to v16 or higher.')
|
|
}
|
|
|
|
startPeriodicGarbageCollection();
|
|
|
|
process.on('unhandledRejection', error => {
|
|
if (error?.constructor !== RPCResultError && error?.constructor !== PluginError) {
|
|
throw error;
|
|
}
|
|
console.warn('unhandled rejection of RPC Result', error);
|
|
});
|
|
|
|
if (process.argv[2] === 'child') {
|
|
require('./scrypted-plugin-main');
|
|
}
|
|
else {
|
|
require('./scrypted-server-main');
|
|
}
|