viewer: Ticket: Viewer(F3) hangups at '.patch' viewing
As stderr closes before process shutdown we get hangup trying to read last data from stderr. Try to read at least something before closing stderr. Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
Этот коммит содержится в:
родитель
b72e83193a
Коммит
e65b0f1986
@ -355,6 +355,27 @@ void open_error_pipe (void)
|
|||||||
close (error_pipe[0]);
|
close (error_pipe[0]);
|
||||||
error_pipe[0] = -1;
|
error_pipe[0] = -1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Settng stderr in nonblocking mode as we close it earlier, than
|
||||||
|
* program stops. We try to read some error at program startup,
|
||||||
|
* but we should not block on it.
|
||||||
|
*
|
||||||
|
* TODO: make piped stdin/stderr poll()/select()able to get rid
|
||||||
|
* of following hack.
|
||||||
|
*/
|
||||||
|
int fd_flags;
|
||||||
|
fd_flags = fcntl (error_pipe[0], F_GETFL, NULL);
|
||||||
|
if (fd_flags != -1)
|
||||||
|
{
|
||||||
|
fd_flags |= O_NONBLOCK;
|
||||||
|
if (fcntl(error_pipe[0], F_SETFL, fd_flags) == -1)
|
||||||
|
{
|
||||||
|
/* TODO: handle it somehow */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/* we never write there */
|
/* we never write there */
|
||||||
close (error_pipe[1]);
|
close (error_pipe[1]);
|
||||||
error_pipe[1] = -1;
|
error_pipe[1] = -1;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user