C
C#7mo ago
hamarb123

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
hamarb123
hamarb123OP7mo ago
cc @SingleAccretion if you know
SingleAccretion
SingleAccretion7mo ago
Only thing I can think of is stdout not being flushed - one can do so by writing an EOL to it.
hamarb123
hamarb123OP7mo ago
I put this at the end of main and it made no difference :harold:
No description
SingleAccretion
SingleAccretion7mo ago
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?
hamarb123
hamarb123OP7mo ago
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
Want results from more Discord servers?
Add your server