85 |
|
struct pollfd fds[3]; |
86 |
|
gint fdssize=2; |
87 |
|
|
88 |
+ |
proc->timer = g_timer_new(); |
89 |
+ |
g_timer_start(proc->timer); |
90 |
+ |
|
91 |
|
/* Setup files in output dir if requested to do so */ |
92 |
|
if(outdir != NULL){ |
93 |
|
proc->file_stdout = g_strdup_printf("%s/%s-STDOUT", outdir, proc->jobname); |
165 |
|
poll(fds, fdssize, -1); |
166 |
|
/* For stdout and stderr see if there is any data, and read it */ |
167 |
|
for(x=0; x<2; x++){ |
168 |
< |
if((fds[x].revents|POLLIN) == fds[x].revents){ |
168 |
> |
if((fds[x].revents & POLLIN) == 0){ |
169 |
|
/* We have data to read */ |
170 |
|
g_io_channel_read_line(sout[x], &readbuf, &rdatasize, NULL, NULL); |
171 |
|
if(rdatasize > 0){ |
183 |
|
} |
184 |
|
} |
185 |
|
/* See if we need to pump more data down stdin */ |
186 |
< |
if((fds[2].revents|POLLOUT) == fds[2].revents){ |
186 |
> |
if((fds[2].revents & POLLOUT) != 0){ |
187 |
|
/* We have data we can write */ |
188 |
|
gchar *nextline; |
189 |
|
gint nextlinesize; |
205 |
|
/* Even if we did get a hangup - lets make sure there is no more data to read first by looping again */ |
206 |
|
if (readdata) continue; |
207 |
|
|
208 |
< |
if(((fds[0].revents|POLLHUP) == fds[0].revents) && ((fds[1].revents|POLLHUP) == fds[1].revents)) break; |
208 |
> |
if(((fds[0].revents & POLLHUP) != 0) && ((fds[1].revents & POLLHUP) != 0)) break; |
209 |
|
} |
210 |
+ |
|
211 |
+ |
g_timer_stop(proc->timer); |
212 |
|
|
213 |
|
g_io_channel_shutdown(sout[0], TRUE, NULL); |
214 |
|
g_io_channel_shutdown(sout[1], TRUE, NULL); |