feat: replace hardcoded buffer sizes with PIPESIZE constant

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 21:27:02 -03:00
parent bf48c37dd8
commit 6719dff149
3 changed files with 8 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ use anyhow::{anyhow, Result};
use std::io::{Write};
use crate::common::is_binary::is_binary;
use crate::common::PIPESIZE;
use crate::config;
use crate::services::item_service::ItemService;
use clap::Command;
@@ -61,7 +62,7 @@ pub fn mode_get(
if detect_binary {
// Read only the first 8192 bytes for binary detection
let mut sample_buffer = vec![0; 8192];
let mut sample_buffer = vec![0; PIPESIZE];
let bytes_read = reader.read(&mut sample_buffer)?;
if is_binary(&sample_buffer[..bytes_read]) {
return Err(anyhow!(
@@ -77,7 +78,7 @@ pub fn mode_get(
// Stream the content to stdout
let mut stdout = std::io::stdout();
let mut buffer = [0; 8192];
let mut buffer = [0; PIPESIZE];
loop {
let bytes_read = reader.read(&mut buffer)?;
if bytes_read == 0 {