#!/usr/bin/python # execv3.py loads a process image in the child import os import sys if len(sys.argv)==1: print 'Less arguments' sys.exit(0) def main(): path = sys.argv[1] arg2 = sys.argv[1:] try: chPID = os.fork() if chPID > 0: print 'In parent' os.waitpid(chPID,0) print 'Child', chPID, 'ends' else: print 'In child' try: os.execv(path, arg2) except: OSError except: OSError main()