File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ use common::hyperfine;
3
3
4
4
use predicates:: prelude:: * ;
5
5
6
+ /// Platform-specific I/O utility.
7
+ /// - On Unix-like systems, defaults to `cat`.
8
+ /// - On Windows, uses `findstr` as an alternative.
9
+ /// See: <https://superuser.com/questions/853580/real-windows-equivalent-to-cat-stdin>
10
+ const STDIN_READ_COMMAND : & str = if cfg ! ( windows) { "findstr x*" } else { "cat" } ;
11
+
6
12
pub fn hyperfine_debug ( ) -> assert_cmd:: Command {
7
13
let mut cmd = hyperfine ( ) ;
8
14
cmd. arg ( "--debug-mode" ) ;
@@ -306,7 +312,7 @@ fn can_pass_input_to_command_from_a_file() {
306
312
. arg ( "--runs=1" )
307
313
. arg ( "--input=example_input_file.txt" )
308
314
. arg ( "--show-output" )
309
- . arg ( "cat" )
315
+ . arg ( STDIN_READ_COMMAND )
310
316
. assert ( )
311
317
. success ( )
312
318
. stdout ( predicate:: str:: contains ( "This text is part of a file" ) ) ;
@@ -318,7 +324,7 @@ fn fails_if_invalid_stdin_data_file_provided() {
318
324
. arg ( "--runs=1" )
319
325
. arg ( "--input=example_non_existent_file.txt" )
320
326
. arg ( "--show-output" )
321
- . arg ( "cat" )
327
+ . arg ( STDIN_READ_COMMAND )
322
328
. assert ( )
323
329
. failure ( )
324
330
. stderr ( predicate:: str:: contains (
You can’t perform that action at this time.
0 commit comments