I'm using MSYS2-x86_64, and whenever I do M-x shell I see the following:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

There is a partial solution: Setting PS1:

export PS1="\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$"

However I have to A) source .bashrc after launching M-x shell (...which doesn't make sense), and it doesn't solve the ioctl message.

Is there an actual fix for this? Not just a PS1 patch? Should I just ignore it? It looks like I can spin off another copy of emacs (from within Emac's M-x shell, launching MSYS2's bash) and kill it with kill [PID], so what am I missing?

  • There is some (spotty) info about this at emacswiki.org/emacs/NTEmacsWithCygwin#toc1 (I assume msys2 is equivalent to cygwin in this respect)
    – npostavs
    Jul 2 '18 at 3:18
  • I'm not sure if this is still the case, but an explanation given here, although old, sounds very convincing: sourceware.org/ml/cygwin/2012-05/msg00114.html essentially, it says, that Emacs compiled for Windows (not Cygwin) will not know how to interact with Bash on Windows, because it thinks it behaves like Windows own shell. Maybe try Emacs from Cygwin instead?
    – wvxvw
    Jul 2 '18 at 5:45

You could put that code in your init.el as

(setenv "PS1" "\\[\\e[32m\\]\\u@\\h \\[\\e[33m\\]\\w\\[\\e[0m\\]\\n\\$")

that would be at least more emacs'y solution then using .bashrc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.