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/installer | |
| 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/installer')
| -rw-r--r-- | crates/shirabe/src/installer/binary_installer.rs | 24 | ||||
| -rw-r--r-- | crates/shirabe/src/installer/library_installer.rs | 6 |
2 files changed, 5 insertions, 25 deletions
diff --git a/crates/shirabe/src/installer/binary_installer.rs b/crates/shirabe/src/installer/binary_installer.rs index 1f70a5ca..2da360d2 100644 --- a/crates/shirabe/src/installer/binary_installer.rs +++ b/crates/shirabe/src/installer/binary_installer.rs @@ -7,7 +7,6 @@ use crate::package::PackageInterfaceHandle; use crate::util::Filesystem; use crate::util::Platform; use crate::util::ProcessExecutor; -use crate::util::Silencer; use shirabe_php_shim::{ basename, basename_with_suffix, chmod, dirname, fclose, fgets, file_exists, file_get_contents_with_max_length, file_put_contents, fopen, is_dir, is_file, is_link, @@ -152,10 +151,7 @@ impl BinaryInstaller { } else { self.install_unixy_proxy_binaries(&bin_path, &link); } - let _ = Silencer::call(|| { - chmod(&bin_path, 0o777 & !umask()); - Ok(()) - }); + chmod(&bin_path, 0o777 & !umask()); } } @@ -179,11 +175,7 @@ impl BinaryInstaller { // attempt removing the bin dir in case it is left empty if is_dir(&self.bin_dir) && self.filesystem.borrow_mut().is_dir_empty(&self.bin_dir) { - let bin_dir = self.bin_dir.clone(); - let _ = Silencer::call(|| { - rmdir(&bin_dir); - Ok(()) - }); + let _ = rmdir(&self.bin_dir); } } @@ -241,22 +233,14 @@ impl BinaryInstaller { if !file_exists(&link) { let code = self.generate_windows_proxy_code(bin_path, &link); file_put_contents(&link, code.as_bytes()); - let link_clone = link.clone(); - let _ = Silencer::call(|| { - chmod(&link_clone, 0o777 & !umask()); - Ok(()) - }); + chmod(&link, 0o777 & !umask()); } } fn install_unixy_proxy_binaries(&self, bin_path: &str, link: &str) { let code = self.generate_unixy_proxy_code(bin_path, link); file_put_contents(link, code.as_bytes()); - let link_owned = link.to_string(); - let _ = Silencer::call(|| { - chmod(&link_owned, 0o777 & !umask()); - Ok(()) - }); + chmod(link, 0o777 & !umask()); } fn initialize_bin_dir(&mut self) { diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs index d3bf4643..c4ac68a9 100644 --- a/crates/shirabe/src/installer/library_installer.rs +++ b/crates/shirabe/src/installer/library_installer.rs @@ -11,7 +11,6 @@ use crate::package::PackageInterfaceHandle; use crate::repository::InstalledRepositoryInterfaceHandle; use crate::util::Filesystem; use crate::util::Platform; -use crate::util::Silencer; use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, dirname, is_dir, is_link, preg_quote, preg_replace, realpath, rmdir, rtrim, strpos, @@ -393,10 +392,7 @@ impl InstallerInterface for LibraryInstaller { if is_dir(&package_vendor_dir) && self.filesystem.borrow().is_dir_empty(&package_vendor_dir) { - let _ = Silencer::call(|| { - rmdir(&package_vendor_dir); - Ok(()) - }); + let _ = rmdir(&package_vendor_dir); } } |
