Support 'gid' option
Refactoring
Handle fork error
Handle pipe error