@@ -263,8 +263,10 @@ void execute_multiple_pipe_cmd(CMD_OPTS_REDIRECT ** cmds, size_t n_cmds) {
263
263
if (cmds [n_cmds - 1 ]-> out_fd != 1 )
264
264
close (cmds [n_cmds - 1 ]-> out_fd );
265
265
waitpid (child_cmd_pid , & status , 0 );
266
- printf ("******************************\n" );
267
- printf ("\nStatus of PID %d: %d\n\n" , child_cmd_pid , status );
266
+ if (cmds [n_cmds - 1 ]-> out_fd == 1 && cmds [n_cmds - 1 ]-> out_redirect_file == NULL )
267
+ printf ("******************************\n" );
268
+ printf ("\nStatus of PID %d: %d\n" , child_cmd_pid , status );
269
+ printf ("______________________________\n\n" );
268
270
}
269
271
}
270
272
@@ -299,6 +301,10 @@ void execute_double_pipe_cmd(CMD_OPTS_REDIRECT * in_cmd,
299
301
int status ;
300
302
close (pipe_fd [0 ][1 ]);
301
303
waitpid (child_cmd_pid , & status , 0 );
304
+ if (in_cmd -> out_fd == 1 && in_cmd -> out_redirect_file == NULL )
305
+ printf ("******************************\n" );
306
+ printf ("\nStatus of PID %d: %d\n" , child_cmd_pid , status );
307
+ printf ("______________________________\n\n" );
302
308
}
303
309
304
310
tee (pipe_fd [0 ][0 ], pipe_fd [1 ][1 ], INT_MAX , 0 );
@@ -341,6 +347,10 @@ void execute_triple_pipe_cmd(CMD_OPTS_REDIRECT * in_cmd,
341
347
int status ;
342
348
close (pipe_fd [0 ][1 ]);
343
349
waitpid (child_cmd_pid , & status , 0 );
350
+ if (in_cmd -> out_fd == 1 && in_cmd -> out_redirect_file == NULL )
351
+ printf ("******************************\n" );
352
+ printf ("\nStatus of PID %d: %d\n" , child_cmd_pid , status );
353
+ printf ("______________________________\n\n" );
344
354
}
345
355
346
356
tee (pipe_fd [0 ][0 ], pipe_fd [1 ][1 ], INT_MAX , 0 );
0 commit comments