@@ -9,7 +9,7 @@ const fs = require("fs");
9
9
const readFile = promisify ( fs . readFile ) ;
10
10
11
11
const WASI = {
12
- Wasmer : ( ) => {
12
+ Wasmer : ( { programName } ) => {
13
13
// Instantiate a new WASI Instance
14
14
const wasmFs = new WasmFs ( ) ;
15
15
// Output stdout and stderr to console
@@ -27,7 +27,7 @@ const WASI = {
27
27
return originalWriteSync ( fd , buffer , offset , length , position ) ;
28
28
} ;
29
29
const wasi = new WasmerWASI ( {
30
- args : [ ] ,
30
+ args : [ programName ] ,
31
31
env : { } ,
32
32
bindings : {
33
33
...WasmerWASI . defaultBindings ,
@@ -44,9 +44,9 @@ const WASI = {
44
44
}
45
45
}
46
46
} ,
47
- MicroWASI : ( ) => {
47
+ MicroWASI : ( { programName } ) => {
48
48
const wasi = new MicroWASI ( {
49
- args : [ ] ,
49
+ args : [ programName ] ,
50
50
env : { } ,
51
51
features : [ useAll ( ) ] ,
52
52
} )
@@ -59,9 +59,9 @@ const WASI = {
59
59
}
60
60
}
61
61
} ,
62
- Node : ( ) => {
62
+ Node : ( { programName } ) => {
63
63
const wasi = new NodeWASI ( {
64
- args : [ ] ,
64
+ args : [ programName ] ,
65
65
env : { } ,
66
66
returnOnExit : true ,
67
67
} )
@@ -91,7 +91,7 @@ const startWasiTask = async (wasmPath, wasiConstructor = selectWASIBackend()) =>
91
91
const swift = new SwiftRuntime ( ) ;
92
92
// Fetch our Wasm File
93
93
const wasmBinary = await readFile ( wasmPath ) ;
94
- const wasi = wasiConstructor ( ) ;
94
+ const wasi = wasiConstructor ( { programName : wasmPath } ) ;
95
95
96
96
// Instantiate the WebAssembly file
97
97
let { instance } = await WebAssembly . instantiate ( wasmBinary , {
0 commit comments