> I want to run something that execs a command line tool, both in the browser. Doable yet?
If it's not possible from Javascript, it's also not possible from WASM, it's as easy as that.
If your command line tool can be compiled to WASM and works within the restrictions of the browser sandbox, it's trivial. But if you want to start a native command line tool from within the browser, it's pretty much impossible (and for good readons).
There's also a grey zone if you need it to work in a specific runtime environment. For instance VSCode extensions allow to run POSIX command line tools compiled to WASI, and those can safely access parts of the filesystem (like reading and writing files in the current project directory).
The asmx.wasm file is a vanilla POSIX cmdline tool which loads and saves files via fopen/fread/frwrite/fclose, and the tool has been compiled with the WASI SDK: https://github.com/WebAssembly/wasi-sdk
But AFAIK there's currently no easy way to get a similar easy to use WASI wrapper in browsers (it's definitely possible though because the VSCode browser version does it - VSCode basically has a filesystem abstraction which works for native filesystems as well as virtualized web filesystems like github repositories).
If it's not possible from Javascript, it's also not possible from WASM, it's as easy as that.
If your command line tool can be compiled to WASM and works within the restrictions of the browser sandbox, it's trivial. But if you want to start a native command line tool from within the browser, it's pretty much impossible (and for good readons).
There's also a grey zone if you need it to work in a specific runtime environment. For instance VSCode extensions allow to run POSIX command line tools compiled to WASI, and those can safely access parts of the filesystem (like reading and writing files in the current project directory).