Files
proxy-scraper-checker/src/utils.rs
T
2025-08-13 16:46:51 +03:00

24 lines
524 B
Rust

use itertools::Itertools as _;
pub async fn is_docker() -> bool {
#[cfg(target_os = "linux")]
{
static CACHE: tokio::sync::OnceCell<bool> =
tokio::sync::OnceCell::const_new();
*CACHE
.get_or_init(async || {
tokio::fs::try_exists("/.dockerenv").await.unwrap_or(false)
})
.await
}
#[cfg(not(target_os = "linux"))]
{
false
}
}
pub fn pretty_error(e: &crate::Error) -> String {
e.chain().join(" \u{2192} ")
}