Skip to content

Unflushed stderr doesn't get captured via CliRunner #2647

@ericfrederich

Description

@ericfrederich

CliRunner flushes stdout but not stderr.

To reproduce:
Invoke a command that uses print with file=sys.stderr which doesn't flush by default (click.secho flushes by default).

Expected results:
Anything written to stderr should be captured in the result of a CliRunner.invoke()

Environment:

  • Python version: 3.11
  • Click version: 8.1.7 as well as main branch here on GitHub

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions