mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-31 12:14:33 +08:00
Try to report IO redirection errors resulting from redirection stderr
darcs-hash:20051129101206-ac50b-970569a8b710d74b6e16a3c09b8848618cec4a7e.gz
This commit is contained in:
parent
8fcacdd5df
commit
c2e6b07b35
16
exec.c
16
exec.c
|
@ -261,17 +261,13 @@ static void handle_child_io( io_data_t *io )
|
||||||
free_fd( io, io->fd );
|
free_fd( io, io->fd );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
We don't mind if this fails, it is just a speculative close
|
|
||||||
to make sure no unexpected untracked fd causes us to fail
|
|
||||||
*/
|
|
||||||
close(io->fd);
|
|
||||||
|
|
||||||
switch( io->io_mode )
|
switch( io->io_mode )
|
||||||
{
|
{
|
||||||
case IO_CLOSE:
|
case IO_CLOSE:
|
||||||
|
close(io->fd);
|
||||||
break;
|
break;
|
||||||
case IO_FILE:
|
case IO_FILE:
|
||||||
|
{
|
||||||
if( (tmp=wopen( io->param1.filename,
|
if( (tmp=wopen( io->param1.filename,
|
||||||
io->param2.flags, 0777 ) )==-1 )
|
io->param2.flags, 0777 ) )==-1 )
|
||||||
{
|
{
|
||||||
|
@ -284,6 +280,8 @@ static void handle_child_io( io_data_t *io )
|
||||||
}
|
}
|
||||||
else if( tmp != io->fd)
|
else if( tmp != io->fd)
|
||||||
{
|
{
|
||||||
|
close(io->fd);
|
||||||
|
|
||||||
if(dup2( tmp, io->fd ) == -1 )
|
if(dup2( tmp, io->fd ) == -1 )
|
||||||
{
|
{
|
||||||
debug( 1,
|
debug( 1,
|
||||||
|
@ -295,7 +293,11 @@ static void handle_child_io( io_data_t *io )
|
||||||
exec_close( tmp );
|
exec_close( tmp );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IO_FD:
|
case IO_FD:
|
||||||
|
{
|
||||||
|
close(io->fd);
|
||||||
/* debug( 3, L"Redirect fd %d in process %ls (%d) from fd %d",
|
/* debug( 3, L"Redirect fd %d in process %ls (%d) from fd %d",
|
||||||
io->fd,
|
io->fd,
|
||||||
p->actual_cmd,
|
p->actual_cmd,
|
||||||
|
@ -311,10 +313,12 @@ static void handle_child_io( io_data_t *io )
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IO_BUFFER:
|
case IO_BUFFER:
|
||||||
case IO_PIPE:
|
case IO_PIPE:
|
||||||
{
|
{
|
||||||
|
close(io->fd);
|
||||||
|
|
||||||
/* debug( 3, L"Pipe fd %d in process %ls (%d) (Through fd %d)",
|
/* debug( 3, L"Pipe fd %d in process %ls (%d) (Through fd %d)",
|
||||||
io->fd,
|
io->fd,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user