WebAssembly / WebAssembly/WASI
Map `Ctrl+C` to cancellation of the main function
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.8k
- Forks
- 333
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 3
Description
Currently, WASI does not describe any way for a CLI guest to receive the Ctrl+C signal (SIGINT on Unix). This signal is commonly used to request graceful shutdown, giving the application some time to e.g.:
- clean up resources,
- flush buffers to disk,
- stop listening for new network requests, while letting the existing ones run to completion,
- etc..
The component model has built-in support for async cancellation, and I think that in the CLI world Ctrl+C maps neatly to cancellation of the main (run) function.
I propose we update the documentation of the run function to say something along the lines of:
If a host wishes to propagate Ctrl+C into the guest, then cancellation of the
runtask is the canonical way to do so.
WDYT?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked proposals/cli/wit-0.3.0-draft/run.wit file and review the run function documentation in light of the Ctrl+C and async-cancellation behavior described here. Check related issue #166 for context, then update the run documentation if the canonical cancellation guidance is accepted; done means the behavior is explicitly documented for hosts and guests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- cli, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100