How to create files before main and pass command line args with net8.0-browser and wasm
I'm wanting to run a .net wasm app with files pre-created (before main function), and with command line arguments. Currently I can get command line arguments to work with
dotnet.withApplicationArguments(...args).run()
, but to create files beforehand, I need the module so I can access FS
on it before running it to add the files, but whenever I do dotnet.create()
it no longer gives me console output (it does still seem to give me the exit code though). For example, dotnet.create().then((x) => { return x.runMainAndExit(undefined, args) }).then((x) => console.log(x))
just prints 1
. What am I doing wrong that I don't get console output from it?
Please ping. Thanks!5 Replies
cc @SingleAccretion if you know
Only thing I can think of is stdout not being flushed - one can do so by writing an EOL to it.
I put this at the end of main and it made no difference :harold:
No real idea then, sorry. You'll have to debug it.
I suppose one clue is that
1
is an error exit code - is it expected?I think so with the arguments I've been testing it with
I did try one I would have thought might give
0
, but I would probably have to just override the return value to be sure