File tree Expand file tree Collapse file tree 4 files changed +9
-57
lines changed
packages/npm-packages/ruby-wasm-wasi Expand file tree Collapse file tree 4 files changed +9
-57
lines changed Original file line number Diff line number Diff line change 62
62
"jest" : " ^29.6.2" ,
63
63
"prettier" : " ^3.0.0" ,
64
64
"rollup" : " ^4.6.1" ,
65
- "@bjorn3/browser_wasi_shim" : " ^0.2.16 " ,
65
+ "@bjorn3/browser_wasi_shim" : " ^0.2.17 " ,
66
66
"typescript" : " ^5.3.2"
67
67
},
68
68
"dependencies" : {
Original file line number Diff line number Diff line change @@ -28,30 +28,6 @@ export const DefaultRubyVM = async (
28
28
const printer = options . consolePrint ?? true ? consolePrinter ( ) : undefined ;
29
29
printer ?. addToImports ( imports ) ;
30
30
31
- {
32
- // WORKAROUND: browser_wasi_shim does not support some syscalls yet
33
- // and returns -1 instead of proper ERRNO values and it results in confusing
34
- // error messages "Success -- /path/to/file".
35
- // Update browser_wasi_shim version when my fix[^1] will be released.
36
- // [^1]: https://github.com/bjorn3/browser_wasi_shim/commit/6193f7482633ef818604375d9755ded67946adfc
37
- const syscalls = imports [ "wasi_snapshot_preview1" ] ;
38
- for ( const name of Object . keys ( syscalls ) ) {
39
- const original = syscalls [ name ] ;
40
- syscalls [ name ] = ( ...args ) => {
41
- const result = original ( ...args ) ;
42
- if ( result === - 1 ) {
43
- return 58 ; // ENOTSUP
44
- }
45
- // browser_wasi_shim's `random_get` returns `undefined` on success
46
- // instead of `0`.
47
- if ( result === undefined ) {
48
- return 0 ; // Success
49
- }
50
- return result ;
51
- } ;
52
- }
53
- }
54
-
55
31
const instance = await WebAssembly . instantiate ( rubyModule , imports ) ;
56
32
await vm . setInstance ( instance ) ;
57
33
Original file line number Diff line number Diff line change @@ -131,30 +131,6 @@ const instantiateWasmerWasi = async (rootTestFile) => {
131
131
printer.addToImports(imports);
132
132
vm.addToImports(imports);
133
133
134
- {
135
- // WORKAROUND: browser_wasi_shim does not support some syscalls yet
136
- // and returns -1 instead of proper ERRNO values and it results in confusing
137
- // error messages " Success -- /path/to/file" .
138
- // Update browser_wasi_shim version when my fix[^1] will be released.
139
- // [^1]: https://github.com/bjorn3/browser_wasi_shim/commit/6193f7482633ef818604375d9755ded67946adfc
140
- const syscalls = imports[" wasi_snapshot_preview1" ]
141
- for (const name of Object.keys(syscalls)) {
142
- const original = syscalls[name];
143
- syscalls[name] = (...args) => {
144
- const result = original(...args);
145
- if (result === -1) {
146
- return 58; // ENOTSUP
147
- }
148
- // browser_wasi_shim' s `random_get` returns `undefined` on success
149
- // instead of `0`.
150
- if (result === undefined) {
151
- return 0; // Success
152
- }
153
- return result;
154
- };
155
- }
156
- }
157
-
158
134
const instance = await WebAssembly.instantiate(rubyModule, imports);
159
135
printer.setMemory(instance.exports.memory);
160
136
await vm.setInstance(instance);
You can’t perform that action at this time.
0 commit comments