aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-16 16:25:35 +0900
committernsfisis <nsfisis@gmail.com>2026-08-16 17:34:46 +0900
commit4065d8842beb5d1648131bd5b1951adf7a27b5b7 (patch)
tree71508f3bfc34330e210227b63619342444b19330 /crates/shirabe/src
parent2bb7e5b09947154fd3b2e20d9f4837482e96ab1a (diff)
downloadphp-shirabe-4065d8842beb5d1648131bd5b1951adf7a27b5b7.tar.gz
php-shirabe-4065d8842beb5d1648131bd5b1951adf7a27b5b7.tar.zst
php-shirabe-4065d8842beb5d1648131bd5b1951adf7a27b5b7.zip
refactor(env): route Shirabe's own env reads through the shim
These sites have no PHP counterpart to mirror, so they read std::env directly. Going through the shim's getenv() keeps every environment read in one place and lets a lint forbid the direct form. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src')
-rw-r--r--crates/shirabe/src/main.rs3
-rw-r--r--crates/shirabe/src/signal.rs4
2 files changed, 4 insertions, 3 deletions
diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs
index c4d9d313..fb0b31f1 100644
--- a/crates/shirabe/src/main.rs
+++ b/crates/shirabe/src/main.rs
@@ -5,9 +5,10 @@ use std::io::IsTerminal as _;
/// Initialize a tracing subscriber from the environment variable `$SHIRABE_TRACING`.
fn init_tracing() {
- let Ok(directives) = std::env::var("SHIRABE_TRACING") else {
+ let Some(directives) = shirabe_php_shim::getenv("SHIRABE_TRACING") else {
return;
};
+ let directives = directives.to_string_lossy();
if directives.is_empty() {
return;
}
diff --git a/crates/shirabe/src/signal.rs b/crates/shirabe/src/signal.rs
index 26297cc7..6ae8dfc1 100644
--- a/crates/shirabe/src/signal.rs
+++ b/crates/shirabe/src/signal.rs
@@ -172,7 +172,7 @@ mod tests {
#[test]
fn exit_with_last_signal_kills_by_the_signal() {
- if std::env::var("SIGNAL_TEST_CHILD").is_ok() {
+ if shirabe_php_shim::getenv("SIGNAL_TEST_CHILD").is_some() {
let signals = SignalSubscription::new();
raise_sigint();
signals.exit_with_last_signal();
@@ -188,7 +188,7 @@ mod tests {
#[test]
fn the_default_disposition_returns_once_no_subscription_is_left() {
- if std::env::var("SIGNAL_TEST_CHILD").is_ok() {
+ if shirabe_php_shim::getenv("SIGNAL_TEST_CHILD").is_some() {
drop(SignalSubscription::new());
raise_sigint();
unreachable!("SIGINT must terminate the process");