fix: split md5sum output on whitespace to extract only the hash value

Co-authored-by: aider (openai/andrew.openrouter.qwen.qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-07-29 11:10:29 -03:00
parent d0ac4cf637
commit 0d1fa6a994

View File

@@ -88,7 +88,19 @@ impl MetaPlugin for MetaPluginProgram {
if output.status.success() { if output.status.success() {
let stdout = String::from_utf8_lossy(&output.stdout); let stdout = String::from_utf8_lossy(&output.stdout);
Ok(stdout.trim().to_string()) let trimmed_result = stdout.trim();
// For certain programs like md5sum, we only want the first part before whitespace
if self.program.ends_with("sum") {
let parts: Vec<&str> = trimmed_result.split_whitespace().collect();
if !parts.is_empty() {
Ok(parts[0].to_string())
} else {
Ok(trimmed_result.to_string())
}
} else {
Ok(trimmed_result.to_string())
}
} else { } else {
let stderr = String::from_utf8_lossy(&output.stderr); let stderr = String::from_utf8_lossy(&output.stderr);
Err(io::Error::new( Err(io::Error::new(