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 // cap-std-sync does not support the sync family of fdflags 19 ("NO_FDFLAGS_SYNC_SUPPORT", "1"), 20 ] 21 } 22 #[cfg(all(unix, not(target_os = "macos")))] 23 { 24 &[ 25 ("ERRNO_MODE_UNIX", "1"), 26 // cap-std-sync does not support the sync family of fdflags 27 ("NO_FDFLAGS_SYNC_SUPPORT", "1"), 28 ] 29 } 30 #[cfg(target_os = "macos")] 31 { 32 &[ 33 ("ERRNO_MODE_MACOS", "1"), 34 // cap-std-sync does not support the sync family of fdflags 35 ("NO_FDFLAGS_SYNC_SUPPORT", "1"), 36 ] 37 } 38 } 39 40 pub fn stdio_is_terminal() -> bool { 41 std::io::stdin().is_terminal() 42 && std::io::stdout().is_terminal() 43 && std::io::stderr().is_terminal() 44 } 45