From e01afb407c4b3eb50e85e7356b0be9489fb26eba Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Wed, 21 May 2025 10:30:39 -0400 Subject: add tool tests --- js/src/util/log.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'js/src/util') diff --git a/js/src/util/log.ts b/js/src/util/log.ts index d05f42dc2..dff97f962 100644 --- a/js/src/util/log.ts +++ b/js/src/util/log.ts @@ -1,4 +1,3 @@ -import fs from "node:fs"; import path from "node:path"; import { AppPath } from "../app/path"; export namespace Log { @@ -11,16 +10,23 @@ export namespace Log { }, }; - export function file(directory: string) { - return; + export async function file(directory: string) { const out = Bun.file( path.join(AppPath.data(directory), "opencode.out.log"), - ).writer(); + ); const err = Bun.file( path.join(AppPath.data(directory), "opencode.err.log"), - ).writer(); - write["out"] = (msg) => out.write(msg); - write["err"] = (msg) => err.write(msg); + ); + const outWriter = out.writer(); + const errWriter = err.writer(); + write["out"] = (msg) => { + outWriter.write(msg); + outWriter.flush(); + }; + write["err"] = (msg) => { + errWriter.write(msg); + errWriter.flush(); + }; } export function create(tags?: Record) { -- cgit v1.2.3