capture stdout and stderr for internal commands

also reworked how errors were propagated back for the commands