diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-24 21:07:26 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-24 21:07:26 +0900 |
| commit | 20f9787cda5b846c730cff97a4c7a3777ff3414a (patch) | |
| tree | 2110607ee9842fa5288665bba56b03020057f432 /crates/shirabe/src/factory.rs | |
| parent | 8cf8c04ab9b5a1f5bc7a8eb3230698f07fb7c204 (diff) | |
| download | php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.tar.gz php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.tar.zst php-shirabe-20f9787cda5b846c730cff97a4c7a3777ff3414a.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/factory.rs')
| -rw-r--r-- | crates/shirabe/src/factory.rs | 19 |
1 files changed, 5 insertions, 14 deletions
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::<bool, anyhow::Error>(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::<bool, anyhow::Error>(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::<bool, anyhow::Error>(mkdir(&dir_owned, 0o777, true).is_ok()) - }); + let _ = mkdir(dir, 0o777, true); } let path = format!("{}/.htaccess", dir); - let _ = Silencer::call(|| { - Ok::<Option<i64>, 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::<bool, anyhow::Error>(is_dir("/etc/xdg"))).unwrap_or(false) + is_dir("/etc/xdg") } fn get_user_dir() -> anyhow::Result<String> { |
