0

I am using the fish shell, which until this moment had been a perfect replacement of the good old bash, but I came across the following problem.

fish does not forward STDERR to STDOUT. Of course if I append ^^&1 (forwards stderr to stdout) to the command that I am running everything is ok, but that is not the default behaviour.

Example:

user@Computer ~> rm non_existing_file
user@Computer ~ [1]> rm non_existing_file ^&1
rm: non_existing_file: No such file or directory
user@Computer ~ [1]>

How do I fix that?

P.S. FTR I am running on OS X Mavericks

6
  • It should not be the default behaviour. Jun 1, 2015 at 16:57
  • @glennjackman I know, but it is! Jun 1, 2015 at 17:04
  • I guess I don't understand your question. Given this command sh -c 'echo stdout; echo stderr >&2' >/dev/null what output do you expect to see? Jun 1, 2015 at 17:08
  • @glennjackman rm non_existing_file returns 1, but does NOT output anything. Only when I explicitly forward stderr to stdout of the command, like this: rm non_existing_file ^&1 I get: rm: non_existing_file: No such file or directory. Jun 1, 2015 at 19:10
  • 1
    @glennjackman github.com/fish-shell/fish-shell/issues/2115 Jun 1, 2015 at 21:55

1 Answer 1

1

Following up on your github comments, I see that the problem was how you use rvm integration into fish. I use this: https://rvm.io/integration/fish

curl -L --create-dirs -o ~/.config/fish/functions/rvm.fish https://raw.github.com/lunks/fish-nuggets/master/functions/rvm.fish

and then add this to config.fish to load the rvm settings into the shell

rvm current >/dev/null
6
  • That solution is not 100% effective since the community is only just rewriting the RVM scripts for fish. Thus problems may occur. The alternative solution is much more effective, since it just builds the RVM environment through bash. Jun 2, 2015 at 15:48
  • I've posted a fixed "alternative" solution here: gist.github.com/itay-grudev/570d3830a651f40b0347 Jun 2, 2015 at 15:49
  • P.S. I also wrote to RVM with a request to update their link. Jun 2, 2015 at 15:49
  • The solution I posted does delegate to bash. While in the bash session, it writes out the environment to a temp file, then in fish, extracts the relevant variables into fish's environment. Jun 2, 2015 at 16:01
  • Well I still think the other solution is much more clean. (6 lines of code. No tmp files..) Don't you agree? Jun 2, 2015 at 16:39

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.