-
Notifications
You must be signed in to change notification settings - Fork 768
Pipe: Review Questions
Question numbers subject to change
Use POSIX calls fork
pipe
dup2
and close
to implement an autograding program. Capture the standardoutput of a child process into a pipe. The child process should exec
the program ./test
with no additional arguments (other than the process name). In the parent process read from the pipe: Exit the parent process as soon as the captured output contains the ! character. Before exiting the parent process send SIGKILL to the child process. Exit 0 if the output contained a !. Otherwise if the child process exits causing the pipe write end to be closed, then exit with a value of 1. Be sure to close the unused ends of the pipe in the parent and child process
Legal and Licensing information: Unless otherwise specified, submitted content to the wiki must be original work (including text, java code, and media) and you provide this material under a Creative Commons License. If you are not the copyright holder, please give proper attribution and credit to existing content and ensure that you have license to include the materials.