Refactor command running and error printing in apptest_runner.py

I'd like to re-use some pieces of apptest_runner.py in an analogous
external_apptest_runner.py, so I'm factoring out a few pieces.

BUG=None
TEST=apptest_runner.py with no failing tests
TEST=apptest_runner.py modified to not pass --example_apptest_arg, which generates a test failure that is correctly surfaced.
R=msw@chromium.org, msw

Review URL: https://codereview.chromium.org/739253010