]> git.lizzy.rs Git - rust.git/commitdiff
test_inherit_env: Don't look for hidden environment variables on Windows
authorTobias Bucher <tobiasbucher5991@gmail.com>
Sun, 22 Nov 2015 11:12:18 +0000 (11:12 +0000)
committerTobias Bucher <tobiasbucher5991@gmail.com>
Sun, 22 Nov 2015 11:12:49 +0000 (11:12 +0000)
Fixes #29972.

src/libstd/process.rs

index d26641dbfcf82265644cf748dee126c7f3216fef..083205e824d59eefd8c539923976afd8d6f522b2 100644 (file)
@@ -803,8 +803,10 @@ fn test_inherit_env() {
         let output = String::from_utf8(result.stdout).unwrap();
 
         for (ref k, ref v) in env::vars() {
-            // don't check windows magical empty-named variables
-            assert!(k.is_empty() ||
+            // Windows has hidden environment variables whose names start with
+            // equals signs (`=`). Those do not show up in the output of the
+            // `set` command.
+            assert!((cfg!(windows) && k.starts_with("=")) ||
                     output.contains(&format!("{}={}", *k, *v)),
                     "output doesn't contain `{}={}`\n{}",
                     k, v, output);