I am using Emacs on Windows 8.
Some processes when run through shell-command will request interactive input, notably commands like git push
(which will ask for user name and password). Sometimes I will accidentially run such commands synchronously (shell-command
without &
) and Emacs will just freeze. The same happened with some commands when I was using bzr
.
After freezing, it will become impossible to resolve the issue from within Emacs – C-g
and any other input is simply ignored – and I have to track down the executable in the task manager. This may be related to the password prompt of git, which even in Cygwin entirely ignores common signals (e.g. C-c
).
Is there some fix for this behaviour? I can do it for git push
specifically with some function-advice for shell-command
, but I'd rather find a general solution.
Workaround
For reference: My current solution is to add an advice to shell-command
, that adds the forgotten ampersand &
, detecting commands by regular expression.
(advice-add #'shell-command :filter-args #'shell-command-git-fix-advice)
(defun shell-command-git-fix-advice (args)
(when (and
(not (string-match-p "&[ \t]*$" (car args)))
(string-match-p "^git +push +" (car args)))
(setcar args (concat (car args) "&")))
args)