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

This also happend in previous versions. This happens because all the parameters received by exec are given in a single command and checking such things have to be done before giving the command to script.