reduce child process stdout and stderr buffer limits in tui renderer

This commit is contained in:
Markus Ylisiurunen 2025-12-04 20:29:29 +02:00
parent f9fd620b8b
commit 69ff9c364c

View file

@ -1895,9 +1895,9 @@ export class TuiRenderer {
if (child.stdout) { if (child.stdout) {
child.stdout.on("data", (data: Buffer) => { child.stdout.on("data", (data: Buffer) => {
stdout += data.toString(); stdout += data.toString();
// Limit buffer size to 10MB // Limit buffer size to 2MB
if (stdout.length > 10 * 1024 * 1024) { if (stdout.length > 2 * 1024 * 1024) {
stdout = stdout.slice(0, 10 * 1024 * 1024); stdout = stdout.slice(0, 2 * 1024 * 1024);
} }
}); });
} }
@ -1905,9 +1905,9 @@ export class TuiRenderer {
if (child.stderr) { if (child.stderr) {
child.stderr.on("data", (data: Buffer) => { child.stderr.on("data", (data: Buffer) => {
stderr += data.toString(); stderr += data.toString();
// Limit buffer size to 10MB // Limit buffer size to 1MB
if (stderr.length > 10 * 1024 * 1024) { if (stderr.length > 1 * 1024 * 1024) {
stderr = stderr.slice(0, 10 * 1024 * 1024); stderr = stderr.slice(0, 1 * 1024 * 1024);
} }
}); });
} }