-
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
^ /dev/null redirection doesn't work on some error messages #1674
Comments
The error message is from fish itself, not the command, so you can't pipe it elsewhere. |
In zsh, bash, dash and ksh it does. And that's the behavior I would expect. From a user perspective it doesn't matter whether an error message is produced by a command or by the shell itself. |
It should resolve your problem. |
@xdudi: This is called workaround, and also bad one, because it's affected by race conditions. |
@tannhuber you can fix this error by using a command you know for sure exists. How about env? env unknown_command > /dev/null ^ /dev/null (I know this is an old issue but it's still open so hope this helps) |
Could you please make it so the following can be silenced completely?
For the record, I'm insisting on using |
I wonder how bash implements this. Does it fork just to output the error message? The recursive cases are a little funny but seem to be handled correctly:
anyone like to check how bash implements this? |
Bash (and presumably zsh and ksh) does the redirection for
You can see this for yourself by starting bash and doing the following
Note that one of the few sh/bash/ksh/zsh features I'd really like to see fish adopt is the ability to use Fish forks when it doesn't need to which is the source of some of our performance problems. However, that isn't really relevant to this issue. The main problem is how the use of the |
@gpakosz, your example fish syntax when translated to the equivalent bash form leaves the shell essentially unusable since you'll no longer see the command prompt or the output of any commands:
At that point bash is waiting for me to type a command. However the bash prompt and the output of whatever command I type is also written to /dev/null. We most definitely do not want to allow that in an interactive fish session. Have you really been doing that in bash just to change the tmux window/pane name? If so there are less dangerous ways to do that. |
@tannhuber, I actually think fish's behavior is more defensible. You also wrote that
But it doesn't. I created this two line script:
When I run it I see this written to my terminal:
The same thing happens in an interactive bash session. Sorry, but the current fish behavior is basically correct. I say "basically" because there may very well be instances where fish is writing to stdout or stderr, as I noted in a previous comment, where it should be, but does not, honor redirection. However, the two examples by @tannhuber and @gpakosz do not work the way they claim and even if they did we do not want fish to behave that way. |
@krader1961 I'm not sure this is the right place to discuss my tmux hack as it's definitely off topic but I don't have a better idea. What I'm doing is: Tmux has no way to rename a pane. You can only name a window. In the following situation:
You can rename the window to I'm exploiting the fact that tmux uses the basename of the command passed to Hope that sheds some light on "why oh why would this guy do this ffs?" |
@gpakosz, That does better explain what you're doing. And you're right: that is unrelated to this issue. You're exploiting a quirk of how bash handles redirections when backgrounding a job. However, when I do that in bash I get output that is little different from what fish provides:
Note that bash actually puts the bogus command into the background then immediately reports that it failed because it could not be found. Whereas fish does this:
I fail to see how that is materially different from what bash did. While I've been using tmux for approximately 10 years (and screen before that) I've never embraced tmux "panes". I limit myself to one or more tmux "windows" inside a single tmux session. So I'm not going to be of much help suggesting a more fish friendly approach. It seems unlikely we're going to modify fish solely to interact with labeling of tmux "panes". However, if you can make an argument for why different behavior would be useful in other contexts please open a new issue and we'll be happy to consider the matter. |
I'm astonished why the following commands produce output:
Is it possible to suppress these error message?
The text was updated successfully, but these errors were encountered: