magit-process-interrupt #5086
petergaultney
started this conversation in
Ideas
Replies: 2 comments
-
here's a potential start on a PR. it looks like this should not be terribly difficult to accomplish. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Here's the approach proposed by @tarsius in #5087 (comment):
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
magit-process-interrupt
works, in that it does successfully kill the running process. However, this is not ergonomic when using some kinds of pre-commit hooks, like for instancepre-commit
.Whatever signal
magit
is sending is an abrupt process kill, the result of which is that a patch file that pre-commit has created to exclude files from its checks never gets reapplied to the repository. This means that changes 'appear' to be lost, when in fact they're just hiding. Some people will know how to have their changes restored from the patch file (and that those patch files live in the user's home directory), but others will not.When running
git
at the shell, in constrast, the standard procedure for a user who wants to stop the commit process is to press Ctrl-C, which sendsSIGINT
to the process, whichpre-commit
handles gracefully, restoring the patch file and leaving things the way a user would expect.Supporting a new command,
magit-process-interrupt
(possibly aliased asmagit-process-ctrl-c
?) would be a nice way to offer users an alternative that does "what they expect" when dealing with long-running pre-commit hooks (and probably other use cases that I don't personally run into).Does this sound like something the project would be interested in supporting? It seems likely to be relatively trivial1, and I'm willing to take a stab at it myself even though I'm no elisp guru.
Footnotes
i have now looked around to see whether the underlying Emacsit looks likekill-process
function has an analogue for sending SIGINT, and so far I'm coming up empty. Possibly this will not be as trivial as I hoped. :)interrupt-process
is a built in function and does send a SIGINT. https://www.gnu.org/software/emacs/manual/html_node/elisp/Signals-to-Processes.html ↩Beta Was this translation helpful? Give feedback.
All reactions