Skip to content

Map Ctrl+C to cancellation of the main function #858

@badeend

Description

@badeend

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 run task is the canonical way to do so.

WDYT?


Related: #166

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-cliProposal: wasi-cli

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions