Map proc_exit to process exit on Node.js
This commit is contained in:
parent
5894a86bac
commit
662d29d305
File diff suppressed because one or more lines are too long
|
@ -63,9 +63,14 @@ export const WasmRunner = (rawOptions: Options | false, SwiftRuntime: SwiftRunti
|
|||
}
|
||||
|
||||
if (extraWasmImports) {
|
||||
// Shallow clone
|
||||
for (const key in extraWasmImports) {
|
||||
importObject[key] = extraWasmImports[key];
|
||||
for (const moduleName in extraWasmImports) {
|
||||
// importObject[moduleName] = extraWasmImports[moduleName];
|
||||
if (!importObject[moduleName]) {
|
||||
importObject[moduleName] = {};
|
||||
}
|
||||
for (const entry in extraWasmImports[moduleName]) {
|
||||
importObject[moduleName][entry] = extraWasmImports[moduleName][entry];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,15 @@ const startWasiTask = async () => {
|
|||
|
||||
const wasmRunner = WasmRunner({ args: testArgs }, runtimeConstructor);
|
||||
|
||||
await wasmRunner.run(wasmBytes);
|
||||
await wasmRunner.run(wasmBytes, {
|
||||
"wasi_snapshot_preview1": {
|
||||
// @bjorn3/browser_wasi_shim raises an exception when
|
||||
// the process exits, but we just want to exit the process itself.
|
||||
proc_exit: (code: number) => {
|
||||
process.exit(code);
|
||||
},
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
startWasiTask().catch((e) => {
|
||||
|
|
Loading…
Reference in New Issue