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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user