qsv icon indicating copy to clipboard operation
qsv copied to clipboard

cat <directory> ignores QSV_SKIP_FORMAT_CHECK

Open allen-chin opened this issue 1 year ago • 1 comments

Describe the bug When using the cat command with a directory as input, qsv will ignore the QSV_SKIP_FORMAT_CHECK and output the following error message if no valid file is in the directory:

No data on stdin. Please provide at least one input file or pipe data to stdin.

If there exists at least one valid file, the command will execute without error and ignore all invalid files.

This behavior was not present in version 4.0.0 but is present in 5.0.3. I would suspect the issue was introduced in 86ca5a66ad82fc6598811934eafb3785d7abb442. Probably affects anything that uses process_input (I don't know Rust so take it with a grain of salt).

To Reproduce Steps to reproduce the behavior:

  1. Create a test folder with an invalid file (e.g. test.txt)
  2. Set QSV_SKIP_FORMAT_CHECK=1
  3. Run qsv cat rows <directory>
PS > $null = New-Item -Path 'test/test.txt' -Force
PS > 'col_name' > 'test/test.txt'
PS > $env:QSV_SKIP_FORMAT_CHECK = 1
PS > qsv --version
qsv 5.0.3-mimalloc-apply;fetch;foreach;geocode;Luau 0.663;prompt;to;polars-0.48.1:release;self_update-16-16;25.34 GiB-4.71 GiB-13.55 GiB-31.67 GiB (x86_64-pc-windows-msvc compiled with Rust 1.87) prebuilt
PS > qsv --envlist
QSV_SKIP_FORMAT_CHECK: "1"

PS > qsv cat rows .\test
No data on stdin. Please provide at least one input file or pipe data to stdin.
PS > qsv cat rows .\test\test.txt
col_name

Expected behavior

PS > qsv cat rows .\test
col_name
PS > qsv cat rows .\test\test.txt
col_name

allen-chin avatar Jun 11 '25 17:06 allen-chin

Thanks for the detailed report @allen-chin .

Your diagnosis was spot on and made the fix trivial.

jqnatividad avatar Jun 11 '25 20:06 jqnatividad