From 20f9787cda5b846c730cff97a4c7a3777ff3414a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 24 Aug 2026 21:07:26 +0900 Subject: refactor(silencer): stop guarding work that stays inside Rust Silencer only lowers the PHP error_reporting() level and re-throws whatever the guarded work raises. A region that never reaches the PHP runtime has no level to lower and emits no diagnostic on failure, so wrapping it is indistinguishable from running it unguarded. The pair kept in Application::hint_common_errors brackets a getComposer() call, which loads installed plugins and dispatches PluginEvents::INIT. Co-Authored-By: Claude Opus 5 --- crates/shirabe/src/factory.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'crates/shirabe/src/factory.rs') diff --git a/crates/shirabe/src/factory.rs b/crates/shirabe/src/factory.rs index 6889a20d..8c696b1f 100644 --- a/crates/shirabe/src/factory.rs +++ b/crates/shirabe/src/factory.rs @@ -48,7 +48,6 @@ use crate::util::Filesystem; use crate::util::HttpDownloader; use crate::util::Platform; use crate::util::ProcessExecutor; -use crate::util::Silencer; use crate::util::r#loop::Loop; use indexmap::IndexMap; use shirabe_php_shim::Catch as _; @@ -135,10 +134,7 @@ impl Factory { // select first dir which exists of: $XDG_CONFIG_HOME/shirabe or ~/.shirabe for dir in &dirs { - let dir_copy = dir.clone(); - let exists = - Silencer::call(|| Ok::(is_dir(&dir_copy))).unwrap_or(false); - if exists { + if is_dir(dir) { return Ok(dir.clone()); } } @@ -177,7 +173,7 @@ impl Factory { { let from = format!("{}/cache", home); let to = format!("{}/Library/Caches/shirabe", user_dir); - let _ = Silencer::call(|| Ok::(rename(&from, &to))); + rename(&from, &to); } return Ok(format!("{}/Library/Caches/shirabe", user_dir)); @@ -298,15 +294,10 @@ impl Factory { for dir in &dirs { if !file_exists(format!("{}/.htaccess", dir)) { if !is_dir(dir) { - let dir_owned = dir.clone(); - let _ = Silencer::call(|| { - Ok::(mkdir(&dir_owned, 0o777, true).is_ok()) - }); + let _ = mkdir(dir, 0o777, true); } let path = format!("{}/.htaccess", dir); - let _ = Silencer::call(|| { - Ok::, anyhow::Error>(file_put_contents(&path, b"Deny from all")) - }); + let _ = file_put_contents(&path, b"Deny from all"); } } } @@ -1578,7 +1569,7 @@ impl Factory { } } - Silencer::call(|| Ok::(is_dir("/etc/xdg"))).unwrap_or(false) + is_dir("/etc/xdg") } fn get_user_dir() -> anyhow::Result { -- cgit v1.3.1-4-g156e