From 2ed17f4877478e20022a0d68bb9f6e3b4f726bb1 Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Mon, 26 May 2025 13:21:15 -0400 Subject: exit properly --- js/src/util/log.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'js/src/util') diff --git a/js/src/util/log.ts b/js/src/util/log.ts index 2d51b0d24..c15e4c59c 100644 --- a/js/src/util/log.ts +++ b/js/src/util/log.ts @@ -1,5 +1,6 @@ import path from "node:path"; import { AppPath } from "../app/path"; +import fs from "fs/promises"; export namespace Log { const write = { out: (msg: string) => { @@ -11,12 +12,12 @@ export namespace Log { }; export async function file(directory: string) { - const out = Bun.file( - path.join(AppPath.data(directory), "opencode.out.log"), - ); - const err = Bun.file( - path.join(AppPath.data(directory), "opencode.err.log"), - ); + const outPath = path.join(AppPath.data(directory), "opencode.out.log"); + const errPath = path.join(AppPath.data(directory), "opencode.err.log"); + await fs.truncate(outPath); + await fs.truncate(errPath); + const out = Bun.file(outPath); + const err = Bun.file(errPath); const outWriter = out.writer(); const errWriter = err.writer(); write["out"] = (msg) => { -- cgit v1.2.3