1 include!(concat!(env!("OUT_DIR"), "/gen.rs")); 2 3 use std::io::IsTerminal; 4 5 /// The wasi-tests binaries use these environment variables to determine their 6 /// expected behavior. 7 /// Used by all of the tests/ which execute the wasi-tests binaries. 8 pub fn wasi_tests_environment() -> &'static [(&'static str, &'static str)] { 9 #[cfg(windows)] 10 { 11 &[ 12 ("ERRNO_MODE_WINDOWS", "1"), 13 // Windows does not support dangling links or symlinks in the filesystem. 14 ("NO_DANGLING_FILESYSTEM", "1"), 15 // Windows does not support renaming a directory to an empty directory - 16 // empty directory must be deleted. 17 ("NO_RENAME_DIR_TO_EMPTY_DIR", "1"), 18 ] 19 } 20 #[cfg(all(unix, not(target_os = "macos")))] 21 { 22 &[("ERRNO_MODE_UNIX", "1")] 23 } 24 #[cfg(target_os = "macos")] 25 { 26 &[("ERRNO_MODE_MACOS", "1")] 27 } 28 } 29 30 pub fn stdio_is_terminal() -> bool { 31 std::io::stdin().is_terminal() 32 && std::io::stdout().is_terminal() 33 && std::io::stderr().is_terminal() 34 } 35