fix: consume stdout concurrently with process exit in auth login (#15058)
This commit is contained in:
@@ -268,18 +268,17 @@ export const AuthLoginCommand = cmd({
|
|||||||
const proc = Process.spawn(wellknown.auth.command, {
|
const proc = Process.spawn(wellknown.auth.command, {
|
||||||
stdout: "pipe",
|
stdout: "pipe",
|
||||||
})
|
})
|
||||||
const exit = await proc.exited
|
|
||||||
if (exit !== 0) {
|
|
||||||
prompts.log.error("Failed")
|
|
||||||
prompts.outro("Done")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!proc.stdout) {
|
if (!proc.stdout) {
|
||||||
prompts.log.error("Failed")
|
prompts.log.error("Failed")
|
||||||
prompts.outro("Done")
|
prompts.outro("Done")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const token = await text(proc.stdout)
|
const [exit, token] = await Promise.all([proc.exited, text(proc.stdout)])
|
||||||
|
if (exit !== 0) {
|
||||||
|
prompts.log.error("Failed")
|
||||||
|
prompts.outro("Done")
|
||||||
|
return
|
||||||
|
}
|
||||||
await Auth.set(args.url, {
|
await Auth.set(args.url, {
|
||||||
type: "wellknown",
|
type: "wellknown",
|
||||||
key: wellknown.auth.env,
|
key: wellknown.auth.env,
|
||||||
|
|||||||
Reference in New Issue
Block a user