-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
external commands launched from config.fish don't have the correct tty modes #2980
Comments
What happens if you press "y" or "n" followed by [ctrl-J] rather than [enter]? Do any other commands that read from stdin ignore their input? For example, what happens if you run |
Fascinating. Yes, if I do that the rm command removes the file and returns, all without echoing any input:
Dunno what that means, but I guess you do.
cat works normally:
So does sort:
|
It suggests the tty modes (e.g., what Please run |
|
The So now the question is why the tty modes aren't being reset to sane values by fish when it spawns an external command. I don't currently have Cygwin environment setup so I can't investigate this. For anyone who can build a debug version to run on Cygwin I would start by instrumenting P.S., The fact that we don't report unexpected syscall failures is itself a problem. We should at least be doing so if the debug level is greater than one. |
Did this work in 2.2.0? |
Yes, it works as expected in fish 2.2.0 in Cygwin. |
Annoyingly, I can't reproduce this - either with the current source, or with the 2.3b1 build from Cygwin. How are you starting fish within mintty? |
OK. In fact, I run fish within screen, in mintty. I didn't check it before, but the input to
But it has the problem inside screen:
Sorry for not checking that before. So is that screen's fault? |
It certainly suggests that there's something in screen that doesn't cooperate with the modes that fish expects, but I'm not sure why. Do you have anything in your |
In Cygwin, /etc/screenrc has:
And my personal ~/.screenrc has:
|
Some more facts:
so when I start fish in a login shell, it takes me directly into a screen session. When this code runs and screen starts automatically, I have the problem. But if I comment out the above, then start a login shell and run screen manually by typing |
Very interesting. If I add
to the bottom of my config.fish it reports |
@andrex-e-schulman: You can workaround the problem by doing Note that this bug has always been present. The problem is that fish doesn't restore the tty modes when running external commands from the startup scripts like ~/.config/fish/config.fish. This bug is simply more noticeable after my change last December to make it possible to bind \cM and \cJ independent of each other by disabling ICRNL mode. |
Thanks @krader1961. I confirm that if I start screen by Unfortunately that solution doesn't work for me, because for me screen is a function that does some work - setting environment variables and so on - before running /usr/bin/screen. When I call that function within config.fish, a subshell is always started first, and it already has So my workaround for now is not to run screen from config.fish. I can live with it. |
I'm doing this as part of fixing issue #2980. The code for managing tty modes and job control is a horrible mess. This is a very tiny step towards improving the situation.
This is closely related to issue #2619 which has already been fixed. |
This seems like something that would be nice for 2.3.1. |
Thanks for continuing to hammer at it. I wish I could help, but alas terminal I/O and tty modes are outside my ken. |
I thought this was fixed in 2.3.1, but now I find that it's not. To reiterate:
The "y" that I typed at the prompt wasn't echoed, and pressing the Enter key didn't work - I had to type Ctrl-J. This was in a shell within screen, when screen was started from ~/.config/fish/config.fish. If I wait instead for the initial fish prompt and then manually launch screen, this problem doesn't occur. The problem is still there in 2.4b1. |
This is still unresolved. Which is why the issue is still open 😄 At the present time the only way to run an external command from your ~/.config/fish/config.fish if it depends on the tty modes is to prefix it with |
I cannot reproduce anymore, this seems to be fixed on the master branch. |
Still broken for me in current Cygwin x86_64, with fish built from the latest HEAD (a26419). |
I can unfortunately also reproduce this issue,
Manually adding Information about the system I was running this on:
|
This is unfortunately not fixed in fish 3.0.2 in Cygwin. |
Okay, I'm pushing a fix for this, which just removes a hack put in in #2578. It's not perfect - in particular it'll cause issues if someone has a slow config.fish and uses something like tmuxinator with a binding for ctrl-j, but I believe that to be a much rarer usecase than "something that prompts in config.fish". Also it's easier to work around (add a "sleep"). |
Confirmed fixed. Thanks! |
When I run
/bin/rm -i
in fish 2.3b1 in Cygwin, the command waits for me to answer y or n, but it doesn't receive any keyboard input. I have to press Ctrl-C to abort the command.Reproduction Steps:
touch tstfile
/bin/rm -i tstfile
/bin/rm: remove regular empty file 'tstfile'?
Expected behavior:
Command accepts y or n as an answer.
Observed behavior:
No keyboard input is accepted. The command hangs until I interrupt it with Ctrl-C.
Additional information:
rm -i
worked fine in fish 2.2.0 in Cygwin.fish-2.3b1-1 is available in Cygwin setup as a test release (or it will be shortly) (click on "Exp" at the top right to see test releases).
Fish version: 2.3b1
Operating system: Cygwin x86_64
Terminal or terminal emulator: mintty
The text was updated successfully, but these errors were encountered: