server: add explicit hook for main file

This commit is contained in:
Koushik Dutta
2023-03-19 14:41:02 -07:00
parent 9bafe97ef6
commit abfd0ffe35
10 changed files with 54 additions and 43 deletions

View File

@@ -58,12 +58,14 @@ export class PythonRuntimeWorker extends ChildProcessWorker {
args.push(this.pluginId);
const types = require.resolve('@scrypted/types');
const PYTHONPATH = types.substring(0, types.indexOf('@scrypted/types') + '@scrypted/types'.length);
this.worker = child_process.spawn(pythonPath, args, {
// stdin, stdout, stderr, peer in, peer out
stdio: ['pipe', 'pipe', 'pipe', 'pipe', 'pipe'],
env: Object.assign({
PYTHONUNBUFFERED: '1',
PYTHONPATH: path.join(process.cwd(), 'node_modules/@scrypted/types'),
PYTHONPATH,
}, gstEnv, process.env, env),
});