From 0582c51754bc3811472a141f9cafd1c03128211f Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 1 Mar 2021 14:32:22 -0500 Subject: [PATCH] test: fix wasi/test-return-on-exit on 32-bit systems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Starting with the V8 8.8 update, this test has been regularly crashing with an out of memory error on 32-bit Windows. The issue has been narrowed down to a function not being bound. This seems like a V8 bug, but at least it seems that we can work around it. Fixes: https://github.com/nodejs/node/issues/37374 PR-URL: https://github.com/nodejs/node/pull/37615 Reviewed-By: Rich Trott Reviewed-By: Michaƫl Zasso --- test/wasi/test-return-on-exit.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/wasi/test-return-on-exit.js b/test/wasi/test-return-on-exit.js index 362d13b490a96f..e61f4174c3d4ee 100644 --- a/test/wasi/test-return-on-exit.js +++ b/test/wasi/test-return-on-exit.js @@ -21,7 +21,8 @@ const buffer = fs.readFileSync(modulePath); // Verify that if a WASI application throws an exception, Node rethrows it // properly. const wasi = new WASI({ returnOnExit: true }); - wasi.wasiImport.proc_exit = () => { throw new Error('test error'); }; + const patchedExit = () => { throw new Error('test error'); }; + wasi.wasiImport.proc_exit = patchedExit.bind(wasi.wasiImport); const importObject = { wasi_snapshot_preview1: wasi.wasiImport }; const { instance } = await WebAssembly.instantiate(buffer, importObject);