Skip to content

Commit

Permalink
[cli] Move resolving of login action to an earlier stage
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Nov 24, 2017
1 parent dfd7f6b commit 4b1d8c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/@sanity/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
"sanity": "./bin/sanity"
},
"scripts": {
"build": "npm test && npm run package-yarn",
"build": "npm test && npm run package-yarn && npm run pack",
"pack": "node scripts/pack.js",
"package-yarn": "node -r babel-register src/scripts/package-yarn.js",
"test": "mocha test/**/*.test.js",
"clean": "rimraf lib",
"clean": "rimraf lib bin/sanity",
"prepublishOnly": "npm run build",
"posttest": "eslint ."
},
Expand Down
3 changes: 2 additions & 1 deletion packages/@sanity/cli/src/actions/login/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ function loginFlow({output, provider, apiClient, cliRoot}, resolve, reject) {
path.join(cliRoot, 'assets', 'loginResponse.html'),
'utf8'
)

res.end(successPage, () => {
req.connection.unref()

server.close(() => {
debug('Server closed')
resolve()
})
})

Expand All @@ -131,6 +131,7 @@ function loginFlow({output, provider, apiClient, cliRoot}, resolve, reject) {

spin.stop()
output.print(chalk.green('Login successful'))
resolve()
}

async function onTokenExchangeError(err, req, res) {
Expand Down

0 comments on commit 4b1d8c9

Please sign in to comment.