sagemathinc / cowasm

CoWasm: Collaborative WebAssembly for Servers and Browsers. Built using Zig. Supports Python with extension modules, including numpy.
https://cowasm.org
BSD 3-Clause "New" or "Revised" License
482 stars 23 forks source link

support signals... at least SIGINT so you can use control+c to interrupt a running computation #11

Closed williamstein closed 2 years ago

williamstein commented 2 years ago

One example where work is needed is

this.stdinBuffer = this.waitForStdin();

in wasi.ts. The above will wait forever for stdin, but should only wait the specified amount of time. For Python in python-wasm/packages/cpython/build/wasm/Modules/readline.c it looks like the amount of time is 0.1 seconds... and after that time, there is an explicit call to check for signals. That said, maybe we'll just end the waitForStdin when there is a signal.