diff --git a/tests/common/util.rs b/tests/common/util.rs index ee76f92b3..6585ddd96 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -30,6 +30,13 @@ static ALREADY_RUN: &str = " you have already run this UCommand, if you want to testing();"; static MULTIPLE_STDIN_MEANINGLESS: &str = "Ucommand is designed around a typical use case of: provide args and input stream -> spawn process -> block until completion -> return output streams. For verifying that a particular section of the input stream is what causes a particular behavior, use the Command type directly."; +/// Test if the program are running under CI +pub fn is_ci() -> bool { + std::env::var("CI") + .unwrap_or(String::from("false")) + .eq_ignore_ascii_case("true") +} + /// Test if the program is running under WSL // ref: @@ // ToDO: test on WSL2 which likely doesn't need special handling; plan change to `is_wsl_1()` if WSL2 is less needy