Skip to content

Commit 98c1b7d

Browse files
committed
Mark aproc as done prior to calling callback
1 parent 3253070 commit 98c1b7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

aproc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ int aproc_drain_all(aproc_t *aprocs, int *ttyfd) {
114114
// Read and invoke callback
115115
if (FD_ISSET(aproc->rfd, &readfds)) {
116116
nbytes = read(aproc->rfd, &buf, 1024);
117+
if (nbytes == 0) aproc->is_done = 1;
117118
buf[nbytes] = '\0';
118119
aproc->callback(aproc, buf, nbytes);
119-
if (nbytes == 0) aproc->is_done = 1;
120120
}
121121
// Destroy on eof.
122122
// Not sure if ferror and feof have any effect here given we're not

0 commit comments

Comments
 (0)