Fix pipe problem

ls | cat | cat
cat | head
cat | cat | head
cat | cat | less
are ok in this version

ps:I still don't understand why some fd can not close in child
process... But this program works well so far