Skip to content

Commit

Permalink
Merge pull request #577 from dimkr/bugfix/truncated-menu
Browse files Browse the repository at this point in the history
Retry select() on dynamic menu pipe if interrupted by SIGCHLD
  • Loading branch information
joewing authored Jun 27, 2022
2 parents d8d4f54 + 7381bff commit 7b647f0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "timing.h"

#include <fcntl.h>
#include <errno.h>

/** Structure to represent a list of commands. */
typedef struct CommandNode {
Expand Down Expand Up @@ -202,7 +203,9 @@ char *ReadFromProcess(const char *command, unsigned timeout_ms)
tv.tv_usec = (diff_ms % 1000) * 1000;

/* Wait for data (or a timeout). */
rc = select(fds[0] + 1, &fs, NULL, &fs, &tv);
do {
rc = select(fds[0] + 1, &fs, NULL, &fs, &tv);
} while(rc < 0 && errno == EINTR);
if(rc == 0) {
close(fds[0]);
/* Timeout */
Expand Down

0 comments on commit 7b647f0

Please sign in to comment.