fix(code-runtime): separate model environment from native startup paths
This commit is contained in:
1 parent
a6f7eeadc6
commit
98d3af0683
12 files changed
+46
-14
No files matched your search
@@ -2,6 +2,7 @@
|
||||
import type { Duplex } from 'node:stream'
|
||||
import { JsonChannel } from './channel.ts'
|
||||
import { runProgram } from './bootstrap.ts'
|
||||
import { STARTUP_ENVIRONMENT_NAMES } from './environment.ts'
|
||||
import type { PatchableStream } from './bootstrap.ts'
|
||||
import type { ReplyMessage, ProgramBootData, ProgramToHost } from './protocol.ts'
|
||||
|
||||
@@ -22,7 +23,11 @@ export interface ProgramProcess {
|
||||
*/
|
||||
export async function runNodeMain(stream: Duplex, maxMessageBytes: number, processState: ProgramProcess): Promise<void> {
|
||||
if (!Number.isSafeInteger(maxMessageBytes) || maxMessageBytes <= 0 || maxMessageBytes > 0xffff_ffff) throw new Error('invalid control message limit')
|
||||
for (const key of Object.keys(processState.env)) Reflect.deleteProperty(processState.env, key)
|
||||
for (const key of Object.keys(processState.env)) {
|
||||
if (!STARTUP_ENVIRONMENT_NAMES.has(key.toUpperCase())) Reflect.deleteProperty(processState.env, key)
|
||||
}
|
||||
// Windows native process creation still needs SystemRoot in the OS environment.
|
||||
processState.env = Object.create(null) as NodeJS.ProcessEnv
|
||||
const boot = Promise.withResolvers<ProgramBootData>()
|
||||
const listeners: Array<(message: ReplyMessage) => void> = []
|
||||
let started = false
|
||||
|
||||
Reference in new issue
Block a user