Skip to content

Input redirection not properly set up when running tool with dnx #54736

@kzu

Description

@kzu

Describe the bug

Consider a dotnet tool that accepts input from a pwsh pipeline via standard piping, i.e. get-process -name foo | mytool.

When the tool is installed via dotnet tool, pwsh will start the tool with input redirected (Console.IsInputRedirected == true) and the tool can process whatever is being piped in.

When running the same tool via dnx mytool, the input is not redirected, causing a difference in behavior that is very hard to account for from within the tool itself.

Steps to reproduce

Create a dotnet tool that renders Console.IsInputRedirected.
Pipe some input to it via pwsh, both directly executed and dnx-executed.

Expected behavior

Input is redirected if the original process (dnx) is input-redirected.

Actual behavior

Tool is always invoked without input redirection.

Is this a regression?

No response

Are there any workarounds?

No response

dotnet --info output

.NET SDK:
 Version:           10.0.301
 Commit:            96856fd726
 Workload version:  10.0.300-manifests.8c7d7c03
 MSBuild version:   18.6.4+96856fd72

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.26200
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\10.0.301\

IDE version

No response

Other details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions