**Summary**
Fixes#4057.
**Test plan**
CI should pass, especially with `build-dist` job.
Manual:
- Run `yarn build-dist`
- Run `node artifacts/yarn-0.28.0.js --version`
- Run `./dist/bin/yarn --version`
Make sure all above commands work without errors.
**Summary**
Refs #3524. We are using `process.exit()` pretty liberally although it is [strongly advised not to use it](https://nodejs.org/api/process.html#process_process_exit_code) since it may cause the `stdout` to get corrupted/terminated before a full flush. This patch changes all possible `process.exit(code)` calls with `process.exitCode = code` statements.
We'd also ideally enable [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule in ESLint but it requires an upgrade to ESLint v4 which should be handled separately.
**Test plan**
Expect tests to pass and actually finish (not run indefinitely due to `yarn` not exiting at all). Also, the script referenced in #3524 to output something like the following:
```
DATA 18
DATA 8192
DATA 8192
DATA 5392
DATA 15
EXIT 0
```
Instead of including all the raw JS files in the dist tarball, just use the single Yarn JS file that's built as part of the build, along with a few other files that are required. This significantly reduces the number of files in the tarball:
```
C:\src\yarn\dist (bundle-as-dist) (yarn@0.23.0-0)
λ find .
.
./bin
./bin/node-gyp-bin
./bin/node-gyp-bin/node-gyp
./bin/node-gyp-bin/node-gyp.cmd
./bin/yarn
./bin/yarn.cmd
./bin/yarn.js
./bin/yarnpkg
./bin/yarnpkg.cmd
./lib
./lib/v8-compile-cache.js
./lib/yarn-cli.js
./LICENSE
./package.json
```
There are three .js files in the archive:
- `lib/v8-compile-cache.js`: Speeds up instantiation time by using the V8 code cache (https://www.npmjs.com/package/v8-compile-cache). This needs to be separate as it has to load **before** the bulk of the application code is loaded, so it can **not** be bundled
- `lib/yarn-cli.js`: Contains all the bundled Yarn code
- `bin/yarn.js`: Entry point to the app, just like today. Loads `v8-compile-cache` then loads `yarn-cli`
This change means that **only** the JavaScript files that are actually used are included, resulting in a nice file size reduction for the installation packages:

Differences are due to differing compression algorithms: Debian packages use xz or LZMA, RedHat uses gzip, Windows installer uses Cabinet
They're also slightly faster to extract:

Testing was performed on my desktop computer (Intel Core i5 6500, Samsung 850 Evo 1TB SSD, Windows 10), with testing for Linux stuff (like installing the Debian package) tested in a Docker container.
Raw data: https://docs.google.com/spreadsheets/d/1d8jdf3DU_GUFdotlPl08PkYa8SkzStK2tgnQ54ivsm0/edit?usp=sharing
Performance is very slightly faster when using `v8-compile-cache` along with the bundled file, but it's not extremely significant (`yarn --version` went from 0.19s to 0.14s on my BuyVM server). The difference might be bigger on servers with slower disks (HDD) or with more overloaded servers.
I also deleted the `build-dist.ps1` file because we _should_ be able to assume that Bash is available on Windows, particularly if Git is installed (as it comes with Git Bash). I need to verify that this works on AppVeyor.
* Support interactive commands in standard MINGW as well
Previous fix only supported some old configuration of Git bash
provided by Git for windows, newer Git bash use standard MINGW
which uses a different `uname` but the fix is ultimately the same
Github: #743
* Refactor: use better variable name when determine to use winpty
* Support both MSYS 32bit and 64bit terminal emulators
* Fix self-update
Pick the correct file to download in self-update
We cannot rely that the first asset is always the tar file
This picks the correct file from the assets
Use dev version of roadrunner and reset it correctly
Enable self-update tests
* Remove github resolving from self-update
* Fix tests.
* Update roadrunner and fix tests
* Increase test timeout to 3 minutes
* disable test because to slow on circleCI
* Rename --quick-sloppy flag from `kpm check` to --integrity
* Make --save implicit when installing new modules, remove strict lockfiles, always create updated lockfile and populate tarball cache
* Add integrity hash check to `kpm install`
* Update kpm.lock
* remove incorrect assert messages
* split up package resolving and fetching
* update kpm.lock
* clean up activityStep, move back cursor at end to cover worker lines - fixes#262
* use fake jest timers
* remove old test
* add mocks to jest test ignore
* fix test fixture lockfile
* Add lockfile version header - fixes#280
* split up `kpm install` into `kpm add` - closes#284
* fix lint
* fix using `latest` tag when adding new dependencies - fixes#263
* clean up kpm entry files
* add useless `kpm version` command
* rename config.js to Config.js
* remove Makefile and switch to simple npm scripts
* add more flow-typed definitions
* correctly case Config file
* fix misc lint
* fix type annotation of PackageConstraintResolver#reduce
* fix bin/kpm nits and unused variable
* use dashed filenames instead of camelcase
* move add command fixtures to separate folder
* hoist common-mirror test folder