-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dash: pipes are not working - RuntimeError: unreachable #46
Comments
Thanks for adding this to the todo list and trying out the cowasm shell. I have indeed not implemented dash pipes yet at all. It requires running a subprocess (all in the same WebAssembly VM) and capturing the output, which is something that probably isn't too hard to figure out and will be exciting. But it's not done. Any other thoughts about cowasm? |
I have several thoughts. My first thought: one of my dream projects is something like: fragments of Ubuntu compiled to wasm But I will have to learn a lot. I am glad, that I was able to install cowasm dash and utils locally. |
Yes, that's basically one way to think of cowasm, except with Ubuntu maybe replaced by FreeBSD. The FreeBSD utilities are mostly much smaller and easier to hack on that corresponding GNU tools, so I was able to build a ton of them for WASM this way, and you can see them all in the shell. Anyway, welcome to the project! |
note that pipes are "incremental", so in theory, they can work on infinite data streams examples ...
there is also a difference between line-buffered and unbuffered ... devil in the details ; ) |
I realize that. Unfortunately it's impossible to support that using the model I'm implementing for this with the current Wasm spec (of one single wasm instance and general wasm code). There's just no way to support multiple processes running at once in general. I might also implement a second much more complicated and less efficient subprocess execution model someday that supports that. |
There are a lot of tradeoffs with speed versus functionality. One extreme for situations where speed is not important, there is https://copy.sh/v86/?profile=archlinux, which is a full Linux install running under WASM via an x86 emulator. But it's an order of magnitude (or more) slower at everything, which is not acceptable for me. |
both ; )
a process scheduler ... sounds like i should continue https://github.com/milahu/shelljs-async |
There was something that did this before WebAssembly -- https://browsix.org/ -- but it was like 100x slower at least, so obviously nobody used it. Of course with WASM and SharedArrayBuffers/Atomics, it is possible to do something that is fast. That said, sharing state, e.g, of the filesystem, environment, etc., becomes much more complicated and slower. Right now, memfs lives only in memory in one single WebWorker, whereas a multi-process approach like Browsix had requires having multiple WebWorkers, and the filesystem becomes much more complicated to share between them. But it's possible. |
Thanks for the links! |
(related: wasmerio/ate#10 , demo is at https://wasmer.sh/ , wasmerio/webassembly.sh#98 (comment) ) |
Neat - I didn't know they actually ported dash and were using that in wasmer.sh too. I wonder if they are solving all the same problems on my todo list already or what approach they have taken... E.g., dash uses setjmp/longjmp, so I've been rewriting it to not do that. |
(if I understand correctly, dash is only in the https://wasmer.sh (the recent website ... i mean , dash is not in the webassembly.sh ) ( in the webassembly.sh (the old website), there is probably a js-written, old, mini-shell ) |
That makes sense, because I don't think I have saw wasmer.sh before. In any case, it's pretty cool that I had the idea to use dash to make a WebAssembly shell at the same time as somebody else, and we both did it... :-). |
this will crash the shell at https://cowasm.sh/
seq 1 10 | head -n 1
js console
The text was updated successfully, but these errors were encountered: