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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions