File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,13 +46,10 @@ resolveModule' = resolveModule
4646
4747initDisco :: IO ()
4848initDisco = do
49- putStrLn $ " Printing Environment"
50- xs <- getEnvironment
51- forM_ xs $ \ (a,b) -> putStrLn $ a <> " = " <> b
52-
53- let filename = " /stdlib/num.disco"
54- putStrLn $ " Printing " <> filename
55- putStrLn =<< readFile filename
49+ -- NOTE: We set path environment variables here,
50+ -- because processing the .wasm module with `wizer` may bake
51+ -- them into the code.
52+ setEnv " disco_datadir" " stdlib"
5653
5754 s <- runM $ resolveModule' FromStdlib " num"
5855 print s
Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ export async function runWASM() {
3030 await addLibFile ( "prop" , fs ) ;
3131 await addLibFile ( "string" , fs ) ;
3232
33+ // NOTE: env: may not work on a .wasm module that was
34+ // processed with the `wizer` tool.
35+ // For this reason,
36+ // we set some environment variables inside the .wasm module.
3337 const wasi = new WASI ( {
34- env : {
35- disco_datadir : "stdlib"
36- } ,
3738 fs : fs ,
3839 stdout : ( out ) => console . log ( "[wasm stdout]" , out ) ,
3940 } ) ;
You can’t perform that action at this time.
0 commit comments