perf: speed up memory batch polling

This commit is contained in:
Peter Steinberger
2026-01-18 03:55:09 +00:00
parent 0d9172d761
commit afb877a96b
10 changed files with 62 additions and 10 deletions

View File

@@ -1,3 +1,5 @@
import { clearActiveProgressLine } from "./terminal/progress-line.js";
export type RuntimeEnv = {
log: typeof console.log;
error: typeof console.error;
@@ -5,8 +7,14 @@ export type RuntimeEnv = {
};
export const defaultRuntime: RuntimeEnv = {
log: console.log,
error: console.error,
log: (...args: Parameters<typeof console.log>) => {
clearActiveProgressLine();
console.log(...args);
},
error: (...args: Parameters<typeof console.error>) => {
clearActiveProgressLine();
console.error(...args);
},
exit: (code) => {
process.exit(code);
throw new Error("unreachable"); // satisfies tests when mocked