Make the . builtin have a more useful (and posix-compatible) exit status

darcs-hash:20071005145808-75c98-17100c1e321b8bca06f75e900db1386451232f98.gz
This commit is contained in:
liljencrantz 2007-10-06 00:58:08 +10:00
parent d34d05ca8b
commit 713c84d821
2 changed files with 8 additions and 0 deletions

View File

@ -2832,6 +2832,10 @@ static int builtin_source( wchar_t ** argv )
argv[0], argv[0],
fn_intern == L"-" ? L"<stdin>" : fn_intern ); fn_intern == L"-" ? L"<stdin>" : fn_intern );
} }
else
{
res = proc_get_last_status();
}
/* /*
Do not close fd after calling reader_read. reader_read Do not close fd after calling reader_read. reader_read

View File

@ -16,6 +16,10 @@ variable.
If no file is specified, or if the file name '-' is used, stdin will If no file is specified, or if the file name '-' is used, stdin will
be read. be read.
The return status of . is the return status of the last job to
execute. If something goes wrong while opening or reading the file,
. exits with a non-zero status.
\subsection source-example Example \subsection source-example Example
<tt>. ~/.fish</tt> <tt>. ~/.fish</tt>