mirror of
https://github.com/sst/opencode.git
synced 2025-08-25 15:34:06 +00:00
fix: format error log (#2184)
This commit is contained in:
parent
133fe41cd5
commit
9a90ce84fb
1 changed files with 19 additions and 9 deletions
|
@ -68,19 +68,29 @@ export namespace Format {
|
||||||
|
|
||||||
for (const item of await getFormatter(ext)) {
|
for (const item of await getFormatter(ext)) {
|
||||||
log.info("running", { command: item.command })
|
log.info("running", { command: item.command })
|
||||||
const proc = Bun.spawn({
|
try {
|
||||||
cmd: item.command.map((x) => x.replace("$FILE", file)),
|
const proc = Bun.spawn({
|
||||||
cwd: App.info().path.cwd,
|
cmd: item.command.map((x) => x.replace("$FILE", file)),
|
||||||
env: { ...process.env, ...item.environment },
|
cwd: App.info().path.cwd,
|
||||||
stdout: "ignore",
|
env: { ...process.env, ...item.environment },
|
||||||
stderr: "ignore",
|
stdout: "ignore",
|
||||||
})
|
stderr: "ignore",
|
||||||
const exit = await proc.exited
|
})
|
||||||
if (exit !== 0)
|
const exit = await proc.exited
|
||||||
|
if (exit !== 0)
|
||||||
|
log.error("failed", {
|
||||||
|
command: item.command,
|
||||||
|
...item.environment,
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
log.error("failed", {
|
log.error("failed", {
|
||||||
|
error,
|
||||||
command: item.command,
|
command: item.command,
|
||||||
...item.environment,
|
...item.environment,
|
||||||
})
|
})
|
||||||
|
// re-raising
|
||||||
|
throw error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue