fd
fd copied to clipboard
Unit test failed on Windows
Checks
- [X] I have read the troubleshooting section and still think this is a bug.
Describe the bug you encountered:
Ran cargo test for testing unit test and two tests failed on a Windows machine.
The error of a cargo test looks like:
failures:
'''
---- test_exec_with_separator stdout ----
thread 'test_exec_with_separator' panicked at 'fd --path-separator=# --absolute-path foo --exec echo
did not exit successfully.
stdout:
stderr:
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
---', tests\testenv\mod.rs:238:13
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
---- test_list_details stdout ----
thread 'test_list_details' panicked at 'fd --list-details
did not exit successfully.
stdout:
stderr:
[fd error]: 'fd --list-details' is not supported on Windows unless GNU 'ls' is installed. ---', tests\testenv\mod.rs:238:13
failures: test_exec_with_separator test_list_details
test result: FAILED. 82 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.79s
error: test failed, to rerun pass --test tests
'''
Describe what you expected to happen:
No response
What version of fd
are you using?
fd 8.7.0
Which operating system / distribution are you on?
Windows version 10.0.20348 Build 20348
Apparently, you don't have an echo
command. Is that normal on windows?
I am running rust using PowerShell in Windows. That is why it says "Command not found: echo". Because it is not available in PowerShell but in CommandLine. The equivalent of echo in powershell is "Write-Output".
@tmccombs I think echo
is just a shell builtin on Windows, there's no standalone echo.exe
. But probably the GitHub actions runners have one from MSYS or something which is why it works in CI. I think fd -x cmd /C echo
should work.
hmm, it looks like some other tests that use echo are configured not to run on windows.
I think the ways we could address this are:
- Don't run these tests on windows
- Don't run these test unless there is an
echo
executable - On windows somehow create an echo executable (shell script?) as part of the test harness
- Use a macro or function that takes a command array, and replaces "echo" with
"cmd", "/C", "echo"
, on windows.
Nope, it looks like fd is broken, at least on powershell on Windows 10 (both within and without neovim):
PS C:\Users\user\app> echo "123"
123
PS C:\Users\user\app> fd -e exe --exec echo {}
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
[fd error]: Command not found: echo
echo is a builtin command in powershell. when you run echo "123"
powershell prints "123" directly, it doesn't invoke a separate program named "echo".