From fb2ed355eceec80b8758b1daf137661706ffd5f3 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Tue, 24 Apr 2012 10:10:43 -0700 Subject: [PATCH] Improve fork reporting Save a couple of forks during init --- exec.cpp | 8 ++++---- share/functions/__fish_config_interactive.fish | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/exec.cpp b/exec.cpp index 227ef9e84..dc69f7ad3 100644 --- a/exec.cpp +++ b/exec.cpp @@ -561,7 +561,7 @@ void exec( parser_t &parser, job_t *j ) */ int exec_error=0; - int needs_keepalive = 0; + bool needs_keepalive = false; process_t keepalive; @@ -672,12 +672,12 @@ void exec( parser_t &parser, job_t *j ) { if( p->next ) { - needs_keepalive = 1; + needs_keepalive = true; break; } if( p != j->first_process ) { - needs_keepalive = 1; + needs_keepalive = true; break; } @@ -1216,7 +1216,7 @@ void exec( parser_t &parser, job_t *j ) fflush(stdout); fflush(stderr); if (g_log_forks) { - printf("Executing fork for internal builtin for '%ls' (io is %p, job_io is %p)\n", p->argv0(), io, j->io); + printf("fork #%d: Executing fork for internal builtin for '%ls' (io is %p, job_io is %p)\n", g_fork_count, p->argv0(), io, j->io); io_print(io); } pid = execute_fork(false); diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 02c795b0c..68dbf5db8 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -207,7 +207,12 @@ function __fish_config_interactive -d "Initializations that should be performed # Reload keybindings when binding variable change function __fish_reload_key_bindings -d "Reload keybindings when binding variable change" --on-variable fish_key_bindings - eval $fish_key_bindings ^/dev/null + # Do something nasty to avoid two forks + if test "$fish_key_bindings" = fish_default_key_bindings + fish_default_key_bindings + else + eval $fish_key_bindings ^/dev/null + end end # Load keybindings