diff options
| author | Aiden Cline <[email protected]> | 2025-08-22 16:09:15 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-22 16:09:15 -0500 |
| commit | 9a90ce84fb2923fd9f32e9e132021c3aaafa5d29 (patch) | |
| tree | 239df78e1bdff07330fdae7e341bec199f89f769 | |
| parent | 133fe41cd5fb0ec3dc03a90e58526408297878fd (diff) | |
| download | opencode-9a90ce84fb2923fd9f32e9e132021c3aaafa5d29.tar.gz opencode-9a90ce84fb2923fd9f32e9e132021c3aaafa5d29.zip | |
fix: format error log (#2184)
| -rw-r--r-- | packages/opencode/src/format/index.ts | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/packages/opencode/src/format/index.ts b/packages/opencode/src/format/index.ts index 52eefa86d..f6a3e2c24 100644 --- a/packages/opencode/src/format/index.ts +++ b/packages/opencode/src/format/index.ts @@ -68,19 +68,29 @@ export namespace Format { for (const item of await getFormatter(ext)) { log.info("running", { command: item.command }) - const proc = Bun.spawn({ - cmd: item.command.map((x) => x.replace("$FILE", file)), - cwd: App.info().path.cwd, - env: { ...process.env, ...item.environment }, - stdout: "ignore", - stderr: "ignore", - }) - const exit = await proc.exited - if (exit !== 0) + try { + const proc = Bun.spawn({ + cmd: item.command.map((x) => x.replace("$FILE", file)), + cwd: App.info().path.cwd, + env: { ...process.env, ...item.environment }, + stdout: "ignore", + stderr: "ignore", + }) + const exit = await proc.exited + if (exit !== 0) + log.error("failed", { + command: item.command, + ...item.environment, + }) + } catch (error) { log.error("failed", { + error, command: item.command, ...item.environment, }) + // re-raising + throw error + } } }) } |
