From 49e1e667a80b9f5f855042b5e830ded6c22730e2 Mon Sep 17 00:00:00 2001 From: Parnic Date: Tue, 14 Dec 2021 12:14:14 -0600 Subject: [PATCH] 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. --- src/Util.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Util.cs b/src/Util.cs index dfff7ff..ce6f01c 100644 --- a/src/Util.cs +++ b/src/Util.cs @@ -22,11 +22,12 @@ internal static class Util lines.Add(line); } - return lines; - } - else - { - return File.ReadAllLines(filename); + if (lines.Any()) + { + return lines; + } } + + return File.ReadAllLines(filename); } }