[Console] fix and refactor exit code handling
merged branch Tobion/console-exit-code (PR #8080)

This PR was merged into the 2.1 branch.

Discussion
----------

[Console] fix and refactor exit code handling

Split of #8038

Commits
-------

5c317b7 [Console] fix and refactor exit code handling
Merge branch '2.1' into 2.2

* 2.1:
  [Console] fix and refactor exit code handling
Merge branch '2.2' into 2.3

* 2.2:
  [Console] fix and refactor exit code handling

Conflicts:
	src/Symfony/Component/Console/Application.php