mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-27 20:25:12 +00:00
Make the not builtin work with shellscript functions
darcs-hash:20051129195030-ac50b-7ada30d327f2dcc8ad23f56b0a36c975cb90c481.gz
This commit is contained in:
parent
4a68a34c50
commit
51c345311a
3 changed files with 18 additions and 14 deletions
22
exec.c
22
exec.c
|
@ -945,11 +945,19 @@ void exec( job_t *j )
|
||||||
/*
|
/*
|
||||||
Handle output from a block or function. This usually
|
Handle output from a block or function. This usually
|
||||||
means do nothing, but in the case of pipes, we have
|
means do nothing, but in the case of pipes, we have
|
||||||
to buffer such io, since otherwisethe internal pipe
|
to buffer such io, since otherwise the internal pipe
|
||||||
buffer might overflow.
|
buffer might overflow.
|
||||||
*/
|
*/
|
||||||
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,10 +1098,7 @@ void exec( job_t *j )
|
||||||
|
|
||||||
case EXTERNAL:
|
case EXTERNAL:
|
||||||
{
|
{
|
||||||
|
pid = fork();
|
||||||
// fwprintf( stderr,
|
|
||||||
// L"fork on %ls\n", j->command );
|
|
||||||
pid = fork ();
|
|
||||||
if( pid == 0 )
|
if( pid == 0 )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1114,8 +1116,8 @@ void exec( job_t *j )
|
||||||
{
|
{
|
||||||
/* The fork failed. */
|
/* The fork failed. */
|
||||||
debug( 0, FORK_ERROR );
|
debug( 0, FORK_ERROR );
|
||||||
wperror (L"fork");
|
wperror( L"fork" );
|
||||||
exit (1);
|
exit( 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
6
expand.c
6
expand.c
|
@ -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
|
||||||
|
|
|
@ -58,7 +58,7 @@ void function_set_desc( const wchar_t *name, const wchar_t *desc );
|
||||||
/**
|
/**
|
||||||
Returns true if the function witrh the name name exists.
|
Returns true if the function witrh the name name exists.
|
||||||
*/
|
*/
|
||||||
int function_exists( const wchar_t *name);
|
int function_exists( const wchar_t *name );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Insert all function names into l. These are not copies of the strings and should not be freed after use.
|
Insert all function names into l. These are not copies of the strings and should not be freed after use.
|
||||||
|
|
Loading…
Reference in a new issue