285 karma · joined June 19, 2021
If you go into settings you can switch stdin echo on/off. I have stdio devices set up to return their file type as "Character Device" (see: https://github.com/taybenlor/runno/blob/main/packages/wasi-m...). It seems like some binaries handle this well and act like they are directly connected to the TTY (e.g. my quickjs example). Not sure how they determine that. I'm very much coming at this from a web-developer interested in WASI direction, and not from any experience with OSes or linux.
Edit: btw my WASI runtime (@runno/wasi-motor) is very much in "I haven't even released it as an NPM package" state but you're welcome to copy the code and use it https://github.com/taybenlor/runno/tree/main/packages/wasi-m...
That's not the WASI runtime being used in this playground. The one in this playground is @runno/wasi-motor (https://github.com/taybenlor/runno/tree/main/packages/wasi-m...). I haven't released it as an NPM package, but it's all MIT so feel free to copy it.
Part of the reason I started working on this playground was because I felt like the Wasmer WASI runner didn't work in the ways I wanted it to. Having a full end-to-end understanding of my WASI implementation has really helped, and I'm looking forward to moving Runno over to my new WASI runtime.
Will look at the FS spec. I would hope that it would be shaped in a way that makes sense for WASI (brief look seems like it is). I'd also love it to be something that makes sense from the JavaScript side as well.
What's super neat here is that I didn't have to build that. The WASI standard defines `fd_fdstat_get` which tells the binary the type of the file descriptor. For stdin/stdout/stderr I return that it is a "Character Device" (https://github.com/taybenlor/runno/blob/main/packages/wasi-m...). QuickJS understands that means it's running in a TTY and so it emits all the right characters to do colouring. XTerm.JS then interprets those characters and displays the appropriate colours.
One really neat thing here is how easy it is to write Rust that targets WASI. If you're into Rust, I'd recommend looking at the source of the demos and then trying out your own WASI binaries.
Here to answer questions if anyone has any!
When building Runno (https://runno.dev) I forked off that project and did a bunch of other things on top to get blocking to work in Safari and non-cross-origin-isolated contexts.
Ultimately I think it's JavaScript's (or whichever host language) responsibility to block when the binary calls out (if that is the expected semantics).
I guess it would depend on the browser. There's two different fallbacks for the IO. So if the env doesn't support SharedArrayBuffer it will fallback to using a ServiceWorker hack. If that's not supported it will fallback to using an input prompt. But if the browser doesn't support WebAssembly there's no fallback mechanism.
PS: Thanks!
There’s a bunch of closed-source solutions that rely on other services. I was hoping for a way to just install a package, and then run code. Especially small snippets like print, input and if statements.
So I started building Runno. It lets you embed snippets of code from a few different languages (Python, JavaScript, C, C++ and SQL currently) within your website and runs it all client side using Web Assembly. You can use it without any packages using an iframe, or install the npm package and use it as a Web Component.
Happy to answer any questions you have about it!
> Eric found that drinking booze… lowered the men’s risk of a heart attack as much as exercising regularly… Which is bonkers!
> So Kaye’s like: ok… all these studies are showing that those who drink have less heart disease than those who don’t… well have you ever thought… who are these non-drinkers in these studies? Like… what kind of person doesn’t drink anything?
> She started looking into the studies that had been done on people who don’t drink and found something kind of shocking. Generally speaking, they were more likely to be unhealthy.
> The people - who did drink… and then stopped… some scientists call them “sick quitters”... Sounds like a bad burn, but basically means they didn't stop drinking because they were running a triathlon, but because they weren’t well.
It's by Hugh White the former deputy-secretary of the Australian Department of Defence.