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