the shell has to release each child process it created via wait()
wait() may get interrupted by a the signal handler, so it is important to examine its return value to make sure that the child actually exited; otherwise, the shell may lose track of the number of children that are still around
after the child process has finished executing the command, it is advisable to flush stdout via fflush(); otherwise there might still be some output from the old process in the buffer used by stdout