Implemented handshaking before child process exit.

After sending test result, child process should wait either a "exit"
message or timeout before quit itself.