added exec(cmd,output,input,error,avpenv) function for exec

That's not very inventively named, is it? :-D

Python popen2 lib called it popen3:

    popen2.popen3(cmd[, bufsize[, mode]])

Perhaps `__popen3` is a better name.