return codes and tests

return code for failed command excutions
tests for command execution