The function exec now shows error and output result