#! /usr/bin/python
import os
import sys
import time

print "I am the parent with ID {0}.".format(os.getpid())
pid = os.fork()

if pid==0:
    print "I am the child with ID {0}.".format(os.getpid())
    for x in range(1, 4):
        print x
        time.sleep(1)
    print "Child going bye bye"
    sys.exit(235)
    print "Should not get here"
else:
    print "I am the parent, waiting for {0}!".format(pid)
    winfo = os.wait()
    print "Goodbye {0} with return {1} and status {2}.".format(
        winfo[0], winfo[1]>>8, winfo[1]&255)
