Fix issue with exit code in non-tty mode.

Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Merge pull request #3708 from creack/fix_run_exit_code

Fix issue with exit code in non-tty mode.