From 782a739736467b61aa5ffbbb5c12beb2c8670812 Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 2 Aug 2007 04:09:01 +1000 Subject: [PATCH] Remove confusing and misleading error message when trying to repaint the prompt during startup, reported by Chris Rebert. darcs-hash:20070801180901-ac50b-43abf47182fcaa19fdbd993d480ac07f2915b6ed.gz --- builtin_commandline.c | 20 +++++++++++++++----- share/config_interactive.fish.in | 6 ++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/builtin_commandline.c b/builtin_commandline.c index c16ed17db..3d6b4451b 100644 --- a/builtin_commandline.c +++ b/builtin_commandline.c @@ -235,13 +235,23 @@ static int builtin_commandline( wchar_t **argv ) if( !get_buffer() ) { + if (is_interactive_session) + { + /* + Prompt change requested while we don't have + a prompt, most probably while reading the + init files. Just ignore it. + */ + return 1; + } + sb_append2( sb_err, - argv[0], - L": Can not set commandline in non-interactive mode\n", - (void *)0 ); + argv[0], + L": Can not set commandline in non-interactive mode\n", + (void *)0 ); builtin_print_help( argv[0], sb_err ); - return 1; - } + return 1; + } woptind=0; diff --git a/share/config_interactive.fish.in b/share/config_interactive.fish.in index dd3084e97..8e18df143 100644 --- a/share/config_interactive.fish.in +++ b/share/config_interactive.fish.in @@ -165,8 +165,10 @@ functions -e set_default # function __fish_repaint --on-variable fish_color_cwd --description "Event handler, repaints the prompt when fish_color_cwd changes" - set -e __fish_prompt_cwd - commandline -f repaint + if status --is-interactive + set -e __fish_prompt_cwd + commandline -f repaint ^/dev/null + end end #