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:
@@ -88,7 +88,19 @@ impl MetaPlugin for MetaPluginProgram {
|
||||
|
||||
if output.status.success() {
|
||||
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 {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
Err(io::Error::new(
|
||||
|
||||
Reference in New Issue
Block a user