Fix bug that caused block level io redirection to break on while loops

darcs-hash:20060514222905-ac50b-7dec0ed716f5fe6af9069b597eee464829a8d820.gz
This commit is contained in:
axel 2006-05-15 08:29:05 +10:00
parent 3d601bd751
commit 5a7a264b96
5 changed files with 17 additions and 15 deletions

View file

@ -1334,7 +1334,7 @@ static int builtin_read( wchar_t **argv )
int exit_res=0;
woptind=0;
while( 1 )
{
const static struct woption

7
exec.c
View file

@ -564,7 +564,7 @@ static void internal_exec_helper( const wchar_t *def,
io_data_t *io_internal = io_transmogrify( io );
int is_block_old=is_block;
is_block=1;
/*
Did the transmogrification fail - if so, set error status and return
*/
@ -575,7 +575,7 @@ static void internal_exec_helper( const wchar_t *def,
}
signal_unblock();
eval( def, io_internal, block_type );
signal_block();
@ -837,7 +837,7 @@ void exec( job_t *j )
io_buffer = io_buffer_create();
j->io = io_add( j->io, io_buffer );
}
internal_exec_helper( p->argv[0], TOP, j->io );
break;
@ -852,6 +852,7 @@ void exec( job_t *j )
if( p == j->first_process )
{
io_data_t *in = io_get( j->io, 0 );
if( in )
{
switch( in->io_mode )

17
io.c
View file

@ -213,37 +213,34 @@ io_data_t *io_get( io_data_t *io, int fd )
return 0;
}
/*
static void io_print( io_data_t *io )
void io_print( io_data_t *io )
{
if( !io )
{
fwprintf( stderr, L"\n" );
return;
}
fwprintf( stderr, L"IO fd %d, type ",
debug( 1, L"IO fd %d, type ",
io->fd );
switch( io->io_mode )
{
case IO_PIPE:
fwprintf(stderr, L"PIPE, data %d\n", io->pipe_fd[io->fd?1:0] );
debug( 1, L"PIPE, data %d", io->param1.pipe_fd[io->fd?1:0] );
break;
case IO_FD:
fwprintf(stderr, L"FD, copy %d\n", io->old_fd );
debug( 1, L"FD, copy %d", io->param1.old_fd );
break;
case IO_BUFFER:
fwprintf( stderr, L"BUFFER\n" );
debug( 1, L"BUFFER" );
break;
default:
fwprintf( stderr, L"OTHER\n" );
debug( 1, L"OTHER" );
}
io_print( io->next );
}
*/

2
io.h
View file

@ -89,4 +89,6 @@ io_data_t *io_buffer_create();
*/
void io_buffer_read( io_data_t *d );
void io_print( io_data_t *io );
#endif

View file

@ -1878,6 +1878,7 @@ static int parse_job( process_t *p,
consumed=1;
is_new_block=1;
}
else if( wcscmp( L"if", nxt ) ==0 )
{
@ -1937,7 +1938,7 @@ static int parse_job( process_t *p,
builtin_exists( (wchar_t *)al_get( args, 0 ) ) )
{
p->type = INTERNAL_BUILTIN;
is_new_block = parser_is_block( (wchar_t *)al_get( args, 0 ) );
is_new_block |= parser_is_block( (wchar_t *)al_get( args, 0 ) );
}
}
@ -2075,6 +2076,7 @@ static int parse_job( process_t *p,
if( !make_sub_block )
{
tok_init( &subtok, end, 0 );
switch( tok_last_type( &subtok ) )
{