fix: add context to file-not-found errors (#7665)

This commit is contained in:
Tunglies
2026-08-02 00:39:10 +00:00
committed by GitHub
parent 837752a768
commit 1599ca0e09
4 changed files with 46 additions and 12 deletions
+10 -6
View File
@@ -348,12 +348,16 @@ impl CoreConfigValidator {
logging!(info, Type::Validate, "验证目录: {}", app_dir_str);
// 使用子进程运行clash验证配置
let command =
app_handle
.shell()
.sidecar(clash_core.as_str())?
.args(["-t", "-d", app_dir_str, "-f", config_path]);
let output = command.output().await?;
let command = app_handle.shell().sidecar(clash_core.as_str()).map_err(|error| {
anyhow::anyhow!("failed to build validation command for core {clash_core:?}: {error:#}")
})?;
let command = command.args(["-t", "-d", app_dir_str, "-f", config_path]);
let output = command.output().await.map_err(|error| {
anyhow::anyhow!(
"failed to run validation core {clash_core:?} for config {config_path:?} in data directory {}: {error:#}",
app_dir.display()
)
})?;
let status = &output.status;
let stderr = &output.stderr;