fix: bug in io_handler
This commit is contained in:
parent
014ed4d827
commit
e27119ba17
|
@ -92,9 +92,12 @@ void io_handler(int sig) {
|
||||||
if (job_data_array[i]->pipeline->capture_output)
|
if (job_data_array[i]->pipeline->capture_output)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
while (read(job_data_array[i]->pipe[0], &c, sizeof(char)) &&
|
while (1)
|
||||||
read(job_data_array[i]->pipe[0], &c, sizeof(char)) != -1)
|
|
||||||
{
|
{
|
||||||
|
int num = read(job_data_array[i]->pipe[0], &c, sizeof(char));
|
||||||
|
if (num == 0 || num == -1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
job_data_array[i]->output_length ++;
|
job_data_array[i]->output_length ++;
|
||||||
job_data_array[i]->output = realloc(job_data_array[i]->output, (job_data_array[i]->output_length + 1) * sizeof(char));
|
job_data_array[i]->output = realloc(job_data_array[i]->output, (job_data_array[i]->output_length + 1) * sizeof(char));
|
||||||
job_data_array[i]->output[job_data_array[i]->output_length - 1] = c;
|
job_data_array[i]->output[job_data_array[i]->output_length - 1] = c;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user