opt_name = mycommand[0]
myargs=[opt_name]
myargs.extend(mycommand[1:])
mypid.append(os.fork())
mypid.insert(0, os.fork())
if mypid[-1] == 0:
# this may look ugly, but basically it moves file descriptors around to ensure no
# handles that are needed are accidentally closed during the final dup2 calls.