mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
Fix a bug where io redirection of builtins would not truncate files if the builtin did not produce any output
darcs-hash:20070324223430-ac50b-3f3d6fd35f5b82c59ecaa06b459fe2b61dc8f387.gz
This commit is contained in:
parent
e8ba091161
commit
e128fa1a8e
1 changed files with 10 additions and 0 deletions
10
exec.c
10
exec.c
|
@ -1317,6 +1317,8 @@ void exec( job_t *j )
|
|||
( !sb_err->used ) &&
|
||||
( !p->next );
|
||||
|
||||
int has_file_redirect = 0;
|
||||
|
||||
/*
|
||||
If the output of a builtin is to be sent to an internal
|
||||
buffer, there is no need to fork. This helps out the
|
||||
|
@ -1337,6 +1339,14 @@ void exec( job_t *j )
|
|||
free( res );
|
||||
}
|
||||
|
||||
for( io = j->io; io; io=io->next )
|
||||
{
|
||||
if( io->io_mode == IO_FILE )
|
||||
{
|
||||
skip_fork = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( skip_fork )
|
||||
{
|
||||
p->completed=1;
|
||||
|
|
Loading…
Reference in a new issue