mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
Make sure fish has the currect exit status
darcs-hash:20061102134859-ac50b-692f9e9aff838ea375e5cf29eeae1e29b1b75338.gz
This commit is contained in:
parent
fab18bae80
commit
13a85ee3f1
4 changed files with 12 additions and 6 deletions
|
@ -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 <a href='index.html'>in html</a> by using the <a href='#help'>help</a> command from inside fish.
|
||||
A commandline shell written mainly with interactive use in mind. The
|
||||
full manual is available <a href='index.html'>in html</a> by using the
|
||||
<a href='#help'>help</a> command from inside fish.
|
||||
|
||||
- <code>-c</code> or <code>--command=COMMANDS</code> evaluate the specified commands instead of reading from the commandline
|
||||
- <code>-d</code> or <code>--debug-level=DEBUG_LEVEL</code> 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
|
|||
- <code>-p</code> or <code>--profile=PROFILE_FILE</code> when fish exits, output timing information on all executed commands to the specified file
|
||||
- <code>-v</code> or <code>--version</code> 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.
|
||||
|
|
5
event.c
5
event.c
|
@ -444,7 +444,8 @@ static void event_fire_internal( event_t *event )
|
|||
for( i=0; i<al_get_count( fire ); i++ )
|
||||
{
|
||||
event_t *criterion = (event_t *)al_get( fire, i );
|
||||
|
||||
int prev_status;
|
||||
|
||||
/*
|
||||
Check if this event has been removed, if so, dont fire it
|
||||
*/
|
||||
|
@ -476,11 +477,13 @@ static void event_fire_internal( event_t *event )
|
|||
they are marked as non-interactive
|
||||
*/
|
||||
proc_push_interactive(0);
|
||||
prev_status = proc_get_last_status();
|
||||
parser_push_block( EVENT );
|
||||
current_block->param1.event = event;
|
||||
eval( (wchar_t *)b->buff, 0, TOP );
|
||||
parser_pop_block();
|
||||
proc_pop_interactive();
|
||||
proc_set_last_status( prev_status );
|
||||
}
|
||||
|
||||
if( b )
|
||||
|
|
4
main.c
4
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();
|
||||
}
|
||||
|
|
2
proc.c
2
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()
|
||||
|
|
Loading…
Reference in a new issue