spectral added a comment.
In https://phab.mercurial-scm.org/D3716#58934, @indygreg wrote: > I agree with @yuja that we should move this to `util.py` or one of its siblings and rename it to `uninterruptable` or some such. > > That being said, signal handlers are process global. And we do need to maintain persistent state so things don't get out of whack if we have overlapping calls, potentially from multiple threads (e.g. in the case of hgweb). So maybe `ui.py` - or even a global variable in that module - is the proper place for such state. > > Also, I wonder if we shouldn't delay signal handling instead of ignoring it. e.g. our new signal handler would print that the signal was received and then `raise KeyboardInterrupt` at context manager exit time. Otherwise, the handling of `SIGINT` is timing dependent and doesn't consistently result in an aborted process. I like this idea. I think bazel does something similar, I know blaze does: one ctrl-c says something like "Shutting down...", three will do a rather forceful shutdown (not kill-9 forceful, but it won't wait for it to get to a convenient spot). Something like that would work well here imho. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3716 To: durin42, #hg-reviewers, indygreg Cc: spectral, indygreg, yuja, martinvonz, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel