summaryrefslogtreecommitdiffhomepage
path: root/js/src/util
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-26 13:21:15 -0400
committerDax Raad <[email protected]>2025-05-26 13:21:15 -0400
commit2ed17f4877478e20022a0d68bb9f6e3b4f726bb1 (patch)
treee6cd5777a13edf3f655960e5820699fce1d86dee /js/src/util
parent80118212da3ce16babdee035974a67fa2f2b8ed9 (diff)
downloadopencode-2ed17f4877478e20022a0d68bb9f6e3b4f726bb1.tar.gz
opencode-2ed17f4877478e20022a0d68bb9f6e3b4f726bb1.zip
exit properly
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/log.ts13
1 files changed, 7 insertions, 6 deletions
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) => {