Fix input redirection for hyperfine

For some reason, Console.IsInputRedirected is true when run under hyperfine even if we're not redirecting anything. I wonder if hyperfine is opening an input channel in case it's needed? Either way, the fix is pretty simply to try reading from stdin and then falling back to the file on disk if our input set is still empty afterward.
This commit is contained in:
2021-12-14 12:14:14 -06:00
parent bd6038c837
commit 49e1e667a8

View File

@ -22,11 +22,12 @@ internal static class Util
lines.Add(line); lines.Add(line);
} }
return lines; if (lines.Any())
} {
else return lines;
{ }
return File.ReadAllLines(filename);
} }
return File.ReadAllLines(filename);
} }
} }