Skip to main content

cargo_util/
lib.rs

1//! Miscellaneous support code used by Cargo.
2//!
3//! > This crate is maintained by the Cargo team, primarily for use by Cargo
4//! > and not intended for external use (except as a transitive dependency). This
5//! > crate may make major changes to its APIs or be deprecated without warning.
6
7#![allow(clippy::disallowed_methods)]
8
9pub use self::read2::read2;
10pub use du::du;
11pub use process_builder::{ExecStats, ProcessBuilder, Stdio};
12pub use process_error::{ProcessError, exit_status_to_string, is_simple_exit_code};
13pub use sha256::Sha256;
14
15pub mod collections;
16mod du;
17pub mod paths;
18mod process_builder;
19mod process_error;
20mod read2;
21pub mod registry;
22mod sha256;
23
24/// Whether or not this running in a Continuous Integration environment.
25pub fn is_ci() -> bool {
26    std::env::var("CI").is_ok() || std::env::var("TF_BUILD").is_ok()
27}
28
29/// Returns `true` if the name contains any glob pattern wildcards.
30pub fn is_glob_pattern<T: AsRef<str>>(name: T) -> bool {
31    name.as_ref().contains(&['*', '?', '[', ']'][..])
32}