fix: implement proper finalize method to capture command output

Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-07-28 16:55:45 -03:00
parent 888f24640e
commit 1023724681

View File

@@ -64,7 +64,28 @@ impl MetaPlugin for MetaPluginProgram {
} }
fn finalize(&mut self) -> io::Result<String> { fn finalize(&mut self) -> io::Result<String> {
Ok("program".to_string()) let program = self.program.clone();
let args = self.args.clone();
debug!("META: Executing command for finalize: {:?} {:?}", program, args);
let output = Command::new(program)
.args(args)
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()?;
if output.status.success() {
let stdout = String::from_utf8_lossy(&output.stdout);
Ok(stdout.trim().to_string())
} else {
let stderr = String::from_utf8_lossy(&output.stderr);
Err(io::Error::new(
io::ErrorKind::Other,
format!("Command failed: {}", stderr.trim()),
))
}
} }
fn update(&mut self, _data: &[u8]) { fn update(&mut self, _data: &[u8]) {