Commit graph

7 commits

Author SHA1 Message Date
ridiculousfish
73f1030bde Fix set_color crash on 'ignore' and 'reset'
https://github.com/fish-shell/fish-shell/issues/996
2013-09-21 15:15:06 -07:00
Ian Munsie
22d1aaa27d Prevent fish dying if setupterm() fails in builtin_set_color()
Since set_color was changed to a built-in command, the entire shell will
exit in the event that setupterm() fails for some reason since ncurses
does an exit() if an errret was not passed in.

setupterm() can fail if the TERM environment variable is not set. This can
cause the shell to die prematurely if set_color is called from a startup
file like config.fish (such as vi-mode.fish which caches the results of
set_color when it is loaded) and fish is started without a TERM set
(e.g. when started from .xsession, or when being used as a remote shell
by a command such as rsync, scp or git)

A simple repro case for this issue is:

ian@delenn~ [i]> echo set_color normal > ~/.config/fish/config.fish
ian@delenn~ [i]> scp localhost:test .
TERM environment variable not set.
ian@delenn~ [i]>

This patch passes in an errret variable to setupterm(), which causes
ncurses to return the error to builtin_set_color() rather than calling
exit():

ian@delenn~ [i]> scp localhost:test .
test                                                 100%    0     0.0KB/s   00:00
ian@delenn~ [i]>

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
2013-05-13 01:35:57 -07:00
ridiculousfish
3a475a99fc Fix gettext macro to stop casting everything to wchar_t * (oops) 2013-03-24 15:58:24 -07:00
ridiculousfish
aaa0c25ff7 Large set of changes to how PATH is handled. Changed fish to no longer modify PATH in share/config.fish. Introduced variable fish_user_paths, and a glue function __fish_reconstruct_path that splices together PATH with fish_user_paths. Changed fish to no longer validate changes to PATH unless the paths are new (i.e. don't recheck what's already there). Modified certain sets to store const wchar_t instead of wcstring to save a few allocations.
https://github.com/fish-shell/fish-shell/issues/527
2013-02-19 18:05:20 -08:00
ridiculousfish
a355cf24f1 Teach set_color to call setupterm so it doesn't crash when run non-interactively 2013-02-15 14:00:25 -08:00
ridiculousfish
12332328c1 Remove set_color from Makefile. Fix issue where builtin_set_color would mix output modes up 2013-02-14 16:46:54 -08:00
ridiculousfish
8d95d0834d First stab at builtin set_color. Moved set_color.cpp to builtin_set_color.cpp and taught fish about it. 2013-02-14 15:52:24 -08:00