Make the not builtin work with shellscript functions

darcs-hash:20051129195030-ac50b-7ada30d327f2dcc8ad23f56b0a36c975cb90c481.gz
This commit is contained in:
axel 2005-11-30 05:50:30 +10:00
parent 4a68a34c50
commit 51c345311a
3 changed files with 18 additions and 14 deletions

14
exec.c
View file

@ -950,6 +950,14 @@ void exec( job_t *j )
*/ */
if( !io_buffer ) if( !io_buffer )
{ {
/*
No buffer, se we exit directly. This means we
have to manually set the exit status.
*/
if( p->next == 0 )
{
proc_set_last_status( j->negate?(status?0:1):status);
}
p->completed = 1; p->completed = 1;
break; break;
} }
@ -960,8 +968,6 @@ void exec( job_t *j )
if( io_buffer->param2.out_buffer->used != 0 ) if( io_buffer->param2.out_buffer->used != 0 )
{ {
pid = fork(); pid = fork();
if( pid == 0 ) if( pid == 0 )
{ {
@ -1044,7 +1050,6 @@ void exec( job_t *j )
{ {
debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status ); debug( 3, L"Set status of %ls to %d using short circut", j->command, p->status );
proc_set_last_status( p->status );
proc_set_last_status( j->negate?(p->status?0:1):p->status ); proc_set_last_status( j->negate?(p->status?0:1):p->status );
} }
break; break;
@ -1093,9 +1098,6 @@ void exec( job_t *j )
case EXTERNAL: case EXTERNAL:
{ {
// fwprintf( stderr,
// L"fork on %ls\n", j->command );
pid = fork(); pid = fork();
if( pid == 0 ) if( pid == 0 )
{ {

View file

@ -92,7 +92,8 @@ parameter expansion.
any tokens which need to be expanded or otherwise altered. Clean any tokens which need to be expanded or otherwise altered. Clean
strings can be passed through expand_string and expand_one without strings can be passed through expand_string and expand_one without
changing them. About 90% of all strings are clean, so skipping changing them. About 90% of all strings are clean, so skipping
expantion on them actually does save a small amount of time. expantion on them actually does save a small amount of time, since
it avoids multiple memory allocations during the expantion process.
*/ */
static int is_clean( const wchar_t *in ) static int is_clean( const wchar_t *in )
{ {
@ -339,7 +340,8 @@ static int match_pid( const wchar_t *cmd,
Searches for a job with the specified job id, or a job or process Searches for a job with the specified job id, or a job or process
which has the string \c proc as a prefix of its commandline. which has the string \c proc as a prefix of its commandline.
If accept_incomplete is true, the remaining string for any matches are inserted. If accept_incomplete is true, the remaining string for any matches
are inserted.
If accept_incomplete is false, any job matching the specified If accept_incomplete is false, any job matching the specified
string is matched, and the job pgid is returned. If no job string is matched, and the job pgid is returned. If no job