Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
spawn: improve the pipe log reading
  • Loading branch information
perexg committed Nov 17, 2014
1 parent 9cabe1a commit cee7147
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/spawn.c
Expand Up @@ -90,9 +90,15 @@ spawn_pipe_read( th_pipe_t *p, char **_buf, int level )
}
buf[len + r] = '\0';
tvhlog_hexdump("spawn", buf + len, r);
while ((s = strchr(buf, '\n')) != NULL) {
while (1) {
s = buf;
while (*s && *s != '\n' && *s != '\r')
s++;
if (*s == '\0')
break;
*s++ = '\0';
tvhlog(level, "spawn", "%s", buf);
if (buf[0])
tvhlog(level, "spawn", "%s", buf);
memmove(buf, s, strlen(s) + 1);
}
if (strlen(buf) == SPAWN_PIPE_READ_SIZE - 1) {
Expand Down

0 comments on commit cee7147

Please sign in to comment.