mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
fix: wait for stdout to flush in generate command (#3821)
This commit is contained in:
@@ -5,6 +5,14 @@ export const GenerateCommand = {
|
||||
command: "generate",
|
||||
handler: async () => {
|
||||
const specs = await Server.openapi()
|
||||
process.stdout.write(JSON.stringify(specs, null, 2))
|
||||
const json = JSON.stringify(specs, null, 2)
|
||||
|
||||
// Wait for stdout to finish writing before process.exit() is called
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
process.stdout.write(json, (err) => {
|
||||
if (err) reject(err)
|
||||
else resolve()
|
||||
})
|
||||
})
|
||||
},
|
||||
} satisfies CommandModule
|
||||
|
||||
Reference in New Issue
Block a user