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 #