[feat] improve error handling for file operations and subprocess execution; refactor main to modularize execution flow

This commit is contained in:
2025-08-08 17:04:42 +02:00
parent c27af0b89a
commit a0216a0e18
3 changed files with 47 additions and 18 deletions

View File

@@ -1,8 +1,6 @@
use crate::OutputEntry;
use crate::{decode_audio_to_pcm_f32_ffmpeg, find_model_file};
use anyhow::{Context, Result, anyhow};
#[cfg(not(test))]
use libloading::Library;
use std::env;
use std::path::Path;
@@ -52,15 +50,8 @@ fn check_lib(names: &[&str]) -> bool {
}
#[cfg(not(test))]
{
if std::env::var("POLYSCRIBE_DISABLE_DLOPEN").ok().as_deref() == Some("1") {
return false;
}
for n in names {
// Attempt to dlopen; ignore errors
if let Ok(_lib) = unsafe { Library::new(n) } {
return true;
}
}
// Disabled runtime dlopen probing to avoid loader instability; rely on environment overrides.
let _ = names;
false
}
}