fix windows cli output when exiting

fixes #17343
This commit is contained in:
João Moreno
2017-01-25 15:59:09 +01:00
parent be6f0f7a00
commit 7de005132b
2 changed files with 46 additions and 2 deletions

View File

@@ -73,9 +73,13 @@ export function main(argv: string[]): TPromise<void> {
return TPromise.as(null);
}
function eventuallyExit(code: number): void {
setTimeout(() => process.exit(code), 0);
}
main(process.argv)
.then(() => process.exit(0))
.then(() => eventuallyExit(0))
.then(null, err => {
console.error(err.stack ? err.stack : err);
process.exit(1);
eventuallyExit(1);
});