mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +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
24
exec.c
24
exec.c
|
@ -941,15 +941,23 @@ void exec( job_t *j )
|
|||
case INTERNAL_FUNCTION:
|
||||
{
|
||||
int status = proc_get_last_status();
|
||||
|
||||
|
||||
/*
|
||||
Handle output from a block or function. This usually
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
@ -960,8 +968,6 @@ void exec( job_t *j )
|
|||
|
||||
if( io_buffer->param2.out_buffer->used != 0 )
|
||||
{
|
||||
|
||||
|
||||
pid = fork();
|
||||
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 );
|
||||
|
||||
proc_set_last_status( p->status );
|
||||
proc_set_last_status( j->negate?(p->status?0:1):p->status );
|
||||
}
|
||||
break;
|
||||
|
@ -1093,10 +1098,7 @@ void exec( job_t *j )
|
|||
|
||||
case EXTERNAL:
|
||||
{
|
||||
|
||||
// fwprintf( stderr,
|
||||
// L"fork on %ls\n", j->command );
|
||||
pid = fork ();
|
||||
pid = fork();
|
||||
if( pid == 0 )
|
||||
{
|
||||
/*
|
||||
|
@ -1114,8 +1116,8 @@ void exec( job_t *j )
|
|||
{
|
||||
/* The fork failed. */
|
||||
debug( 0, FORK_ERROR );
|
||||
wperror (L"fork");
|
||||
exit (1);
|
||||
wperror( L"fork" );
|
||||
exit( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
6
expand.c
6
expand.c
|
@ -92,7 +92,8 @@ parameter expansion.
|
|||
any tokens which need to be expanded or otherwise altered. Clean
|
||||
strings can be passed through expand_string and expand_one without
|
||||
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 )
|
||||
{
|
||||
|
@ -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
|
||||
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
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue