yash-rs
yash-rs copied to clipboard
Interrupt on SIGINT
trafficstars
Although POSIX says the shell should perform "no action" on catching SIGINT, most existing shell implementations interrupt the currently running command line on SIGINT, allowing the user to quit from blocking built-ins such as wait and read. It would be desirable to implement this behavior in yash-rs, too.
The implementation boils down to the following steps:
- [ ] Interrupt if a foreground job is terminated by SIGINT
- [ ] Interrupt if the shell itself catches SIGINT
Questions:
- [ ] Should we handle SIGINT in each built-in individually, or in the read-eval-loop comprehensively?
- [ ] The
SharedSystem::read_asyncandSharedSystem::write_allfunctions enable the file descriptor's blocking mode temporarily. If the execution of these functions is terminated abruptly, the file descriptor may be left without being restored to the previous blocking mode configuration. How do we avoid this?