fix(xo-cli): close connection on sign in error

Otherwise the CLI does not stop.
This commit is contained in:
Julien Fontanet 2024-01-03 17:06:22 +01:00
parent 3d6defca37
commit c14261a0bc
2 changed files with 7 additions and 1 deletions

View File

@ -29,6 +29,7 @@
<!--packages-start-->
- xo-cli patch
- xo-server patch
<!--packages-end-->

View File

@ -44,7 +44,12 @@ async function connect() {
const xo = new Xo({ rejectUnauthorized: !allowUnauthorized, url: server })
await xo.open()
await xo.signIn({ token })
try {
await xo.signIn({ token })
} catch (error) {
await xo.close()
throw error
}
return xo
}