Skip to content

Commit

Permalink
server: add SCRYPTED_COMPATIBILITY_FILE (#1479)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 authored May 19, 2024
1 parent 75bb15d commit f2c940c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/src/scrypted-main-exports.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import dns from 'dns';
import dotenv from 'dotenv';
import fs from 'fs';
import path from 'path';
import process from 'process';
import semver from 'semver';
Expand All @@ -17,6 +18,13 @@ export function isChildProcess() {
function start(mainFilename: string, options?: {
onRuntimeCreated?: (runtime: Runtime) => Promise<void>,
}) {
// Allow including a custom file path for platforms that require
// compatibility hacks. For example, Android may need to patch
// os functions.
if (process.env.SCRYPTED_COMPATIBILITY_FILE && fs.existsSync(process.env.SCRYPTED_COMPATIBILITY_FILE)) {
require(process.env.SCRYPTED_COMPATIBILITY_FILE);
}

if (!global.gc) {
v8.setFlagsFromString('--expose_gc')
global.gc = vm.runInNewContext("gc");
Expand Down

0 comments on commit f2c940c

Please sign in to comment.