From 4aa1cf69ad4abe9f28d28afeb64a990bf71f0ef6 Mon Sep 17 00:00:00 2001 From: Karl Horky Date: Mon, 16 Jul 2018 16:02:16 +0200 Subject: [PATCH] Fix issue with process.exit() w. unflushed buffers Ref: https://github.com/facebook/jest/pull/5313 --- cli/package.json | 1 + cli/src/__tests__/__snapshots__/e2e.test.js.snap | 8 ++++++-- cli/src/cli/visit.js | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cli/package.json b/cli/package.json index fb0756cf56..fab697ab45 100644 --- a/cli/package.json +++ b/cli/package.json @@ -61,6 +61,7 @@ "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "chalk": "^2.4.1", + "exit": "^0.1.2", "findup-sync": "^2.0.0", "graphql": "^0.13.2", "hosted-git-info": "^2.6.0", diff --git a/cli/src/__tests__/__snapshots__/e2e.test.js.snap b/cli/src/__tests__/__snapshots__/e2e.test.js.snap index 0d4a7b2320..f2e473c141 100644 --- a/cli/src/__tests__/__snapshots__/e2e.test.js.snap +++ b/cli/src/__tests__/__snapshots__/e2e.test.js.snap @@ -92,7 +92,8 @@ exports[`lagu should list all projects 1`] = ` ║ ci-node │ ssh://git@192.168.99.1:2222/git/node.git │ true │ true │ ║ ╟───────────────────────┼────────────────────────────────────────────────────────┼──────────┼───────────────┼─────────────────────╢ ║ ci-rest │ ssh://git@192.168.99.1:2222/git/rest.git │ true │ true │ ║ -╚═══════════════════════╧═══════════════�" +╚═══════════════════════╧════════════════════════════════════════════════════════╧══════════╧═══════════════╧═════════════════════╝ +" `; exports[`lagu should list no environments for a project with none (using --project option) 1`] = ` @@ -133,7 +134,10 @@ exports[`lagu should list the new project among all projects 1`] = ` ║ ci-node │ ssh://git@192.168.99.1:2222/git/node.git │ true │ true │ ║ ╟───────────────────────┼────────────────────────────────────────────────────────┼──────────┼───────────────┼─────────────────────╢ ║ ci-rest │ ssh://git@192.168.99.1:2222/git/rest.git │ true │ true │ ║ -╟───────────────────────┼───────────────�" +╟───────────────────────┼────────────────────────────────────────────────────────┼──────────┼───────────────┼─────────────────────╢ +║ e2e-test-project │ ssh://git@192.168.99.1:2222/git/e2e-test-project.git │ true │ true │ ║ +╚═══════════════════════╧════════════════════════════════════════════════════════╧══════════╧═══════════════╧═════════════════════╝ +" `; exports[`lagu should log an error for a non-existent project (using --project option) 1`] = `"No project 'non-existent-project' found."`; diff --git a/cli/src/cli/visit.js b/cli/src/cli/visit.js index 0d2e5fc041..a327c38d51 100644 --- a/cli/src/cli/visit.js +++ b/cli/src/cli/visit.js @@ -1,5 +1,6 @@ // @flow +import exit from 'exit'; import { printErrors } from '../printErrors'; import typeof Yargs from 'yargs'; @@ -46,6 +47,6 @@ export function visit(cmd: CommandModule) { process.exit(exitCode); }) // Process returned with an exit code of typically 0 (success) or 1 (failure) - .then(code => process.exit(code)), + .then(code => exit(code)), }; }