Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: dotnet test failure in CliTests.Should_Return_Error_When_No_DirectoryOrFile_And_Not_Piping_StdIn #1458

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

ogaken-1
Copy link
Contributor

Problem

The test CliTests.Should_Return_Error_When_No_DirectoryOrFile_And_Not_Piping_StdIn was consistently failing when executed via the dotnet test command.

This issue appears to have been caused by CliWrap, which initializes ProcessStartInfo with RedirectStandardInput = true by default. This behavior interfered with the test, as it relies on Console.IsInputRedirected being false.

Solution

This patch updates the test to use ProcessStartInfo directly instead of relying on CliWrap. This ensures that RedirectStandardInput is explicitly set to false.

ogaken-1 and others added 3 commits January 24, 2025 02:13
…irectoryOrFile_And_Not_Piping_StdIn`

Problem:

The test `CliTests.Should_Return_Error_When_No_DirectoryOrFile_And_Not_Piping_StdIn`
was consistently failing when executed via the `dotnet test` command.

This issue appears to have been caused by CliWrap, which initializes
`ProcessStartInfo` with `RedirectStandardInput = true` by default.
This behavior interfered with the test, as it relies on
`Console.IsInputRedirected` being `false`.

Solution:

This patch updates the test to use `ProcessStartInfo` directly
instead of relying on CliWrap. This ensures that `RedirectStandardInput`
is explicitly set to `false`.
Copy link
Owner

@belav belav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this passes on the GH action, but it also did fail for me when I tried dotnet test locally. Maybe it is a windows vs linux thing. Either way this looks good, thanks for figuring out a fix!

@belav belav merged commit 3c08d4e into belav:main Jan 24, 2025
4 checks passed
@ogaken-1 ogaken-1 deleted the fix-clitest branch January 24, 2025 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants