fix: buffer data in meta plugin for finalize command
Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -17,6 +17,7 @@ pub struct MetaPluginProgram {
|
|||||||
pub supported: bool,
|
pub supported: bool,
|
||||||
pub meta_name: String,
|
pub meta_name: String,
|
||||||
pub is_default: bool,
|
pub is_default: bool,
|
||||||
|
buffer: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MetaPluginProgram {
|
impl MetaPluginProgram {
|
||||||
@@ -30,6 +31,7 @@ impl MetaPluginProgram {
|
|||||||
supported,
|
supported,
|
||||||
meta_name,
|
meta_name,
|
||||||
is_default,
|
is_default,
|
||||||
|
buffer: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,12 +71,20 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
|
|
||||||
debug!("META: Executing command for finalize: {:?} {:?}", program, args);
|
debug!("META: Executing command for finalize: {:?} {:?}", program, args);
|
||||||
|
|
||||||
let output = Command::new(program)
|
let mut process = Command::new(program)
|
||||||
.args(args)
|
.args(args)
|
||||||
.stdin(Stdio::null())
|
.stdin(Stdio::piped())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
.output()?;
|
.spawn()
|
||||||
|
.map_err(|e| io::Error::new(io::ErrorKind::Other, format!("Failed to spawn process: {}", e)))?;
|
||||||
|
|
||||||
|
let stdin = process.stdin.as_mut().unwrap();
|
||||||
|
stdin.write_all(&self.buffer)
|
||||||
|
.map_err(|e| io::Error::new(io::ErrorKind::Other, format!("Failed to write to stdin: {}", e)))?;
|
||||||
|
|
||||||
|
let output = process.wait_with_output()
|
||||||
|
.map_err(|e| io::Error::new(io::ErrorKind::Other, format!("Failed to wait for process: {}", e)))?;
|
||||||
|
|
||||||
if output.status.success() {
|
if output.status.success() {
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
@@ -88,8 +98,8 @@ impl MetaPlugin for MetaPluginProgram {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, _data: &[u8]) {
|
fn update(&mut self, data: &[u8]) {
|
||||||
// This is handled by the ProgramWriter implementation
|
self.buffer.extend_from_slice(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn meta_name(&mut self) -> String {
|
fn meta_name(&mut self) -> String {
|
||||||
|
|||||||
Reference in New Issue
Block a user