Skip to content

Commit 088a81c

Browse files
authored
fix: consume stdout concurrently with process exit in auth login (#15058)
1 parent d848c9b commit 088a81c

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • packages/opencode/src/cli/cmd

packages/opencode/src/cli/cmd/auth.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,17 @@ export const AuthLoginCommand = cmd({
268268
const proc = Process.spawn(wellknown.auth.command, {
269269
stdout: "pipe",
270270
})
271-
const exit = await proc.exited
272-
if (exit !== 0) {
271+
if (!proc.stdout) {
273272
prompts.log.error("Failed")
274273
prompts.outro("Done")
275274
return
276275
}
277-
if (!proc.stdout) {
276+
const [exit, token] = await Promise.all([proc.exited, text(proc.stdout)])
277+
if (exit !== 0) {
278278
prompts.log.error("Failed")
279279
prompts.outro("Done")
280280
return
281281
}
282-
const token = await text(proc.stdout)
283282
await Auth.set(args.url, {
284283
type: "wellknown",
285284
key: wellknown.auth.env,

0 commit comments

Comments
 (0)