diff --git a/doc_src/fish.txt b/doc_src/fish.txt index 32a56aa8f..b3f7e429a 100644 --- a/doc_src/fish.txt +++ b/doc_src/fish.txt @@ -5,7 +5,9 @@ fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]] \subsection fish-description Description -A commandline shell written mainly with interactive use in mind. The full manual is available in html by using the help command from inside fish. +A commandline shell written mainly with interactive use in mind. The +full manual is available in html by using the +help command from inside fish. - -c or --command=COMMANDS evaluate the specified commands instead of reading from the commandline - -d or --debug-level=DEBUG_LEVEL specify the verbosity level of fish. A higher number means higher verbosity. The default level is 1. @@ -16,3 +18,6 @@ A commandline shell written mainly with interactive use in mind. The full manual - -p or --profile=PROFILE_FILE when fish exits, output timing information on all executed commands to the specified file - -v or --version display version and exit +The fish exit status is generally the exit status of the last +foreground command. If fish is exiting because of a parse error, the +exit status is 127. diff --git a/event.c b/event.c index 2df1e79d7..4685c6aa3 100644 --- a/event.c +++ b/event.c @@ -444,7 +444,8 @@ static void event_fire_internal( event_t *event ) for( i=0; iparam1.event = event; eval( (wchar_t *)b->buff, 0, TOP ); parser_pop_block(); proc_pop_interactive(); + proc_set_last_status( prev_status ); } if( b ) diff --git a/main.c b/main.c index 5bf3dab9f..7c5f5d919 100644 --- a/main.c +++ b/main.c @@ -382,7 +382,6 @@ int main( int argc, char **argv ) } proc_fire_event( L"PROCESS_EXIT", EVENT_EXIT, getpid(), res ); - history_destroy(); proc_destroy(); @@ -399,6 +398,5 @@ int main( int argc, char **argv ) intern_free_all(); - - return res; + return res?STATUS_UNKNOWN_COMMAND:proc_get_last_status(); } diff --git a/proc.c b/proc.c index 72a5d12c1..fa1c660bb 100644 --- a/proc.c +++ b/proc.c @@ -191,7 +191,7 @@ void proc_set_last_status( int s ) { last_status = s; - // fwprintf( stderr, L"Set last status to %d\n", s ); +// debug( 0, L"Set last status to %d\n", s ); } int proc_get_last_status()