Skip to content

Don't output "Checking" progress when stdout is piped/redirected #21

Description

@injust

Because of #20, I pipe prek's output through a pager like less, or redirect it to a file. However, this appears at the top of the output, after the list of hooks:

Checking ------------------------------------------------------------ 1/19 files
Checking ------------------------------------------------------------ 2/19 files
Checking ------------------------------------------------------------ 3/19 files
Checking ------------------------------------------------------------ 4/19 files
Checking ------------------------------------------------------------ 5/19 files
Checking ------------------------------------------------------------ 6/19 files
Checking ------------------------------------------------------------ 7/19 files
Checking ------------------------------------------------------------ 8/19 files
Checking ------------------------------------------------------------ 9/19 files
Checking ------------------------------------------------------------ 10/19 files                                                                               

Checking ------------------------------------------------------------ 11/19 files                                                                               

Checking ------------------------------------------------------------ 12/19 files                                                                               

Checking ------------------------------------------------------------ 13/19 files                                                                               

Checking ------------------------------------------------------------ 14/19 files                                                                               

Checking ------------------------------------------------------------ 15/19 files                                                                               

Checking ------------------------------------------------------------ 16/19 files                                                                               

Checking ------------------------------------------------------------ 17/19 files                                                                               

Checking ------------------------------------------------------------ 18/19 files                                                                               

Checking ------------------------------------------------------------ 19/19 files                                                                               

When using less, it appears in the terminal as:

  Checking ------------------------------------------------------------ 1/19 files^MChecking ------------------------------------------------------------ 2/19 files^MChecking ------------------------------------------------------------ 3/19 files^MChecking ------------------------------------------------------------ 4/19 files^MChecking ------------------------------------------------------------ 5/19 files^MChecking ------------------------------------------------------------ 6/19 files^MChecking ------------------------------------------------------------ 7/19 files^MChecking ------------------------------------------------------------ 8/19 files^MChecking ------------------------------------------------------------ 9/19 files^MChecking ------------------------------------------------------------ 10/19 files                                                                               ^MChecking ------------------------------------------------------------ 11/19 files                                                                               ^MChecking ------------------------------------------------------------ 12/19 files                                                                               ^MChecking ------------------------------------------------------------ 13/19 files                                                                               ^MChecking ------------------------------------------------------------ 14/19 files                                                                               ^MChecking ------------------------------------------------------------ 15/19 files                                                                               ^MChecking ------------------------------------------------------------ 16/19 files                                                                               ^MChecking ------------------------------------------------------------ 17/19 files                                                                               ^MChecking ------------------------------------------------------------ 18/19 files                                                                               ^MChecking ------------------------------------------------------------ 19/19 files                                                                               ^M

I normally don't see the word "Checking" in prek's output in the terminal, so I'm not sure where this comes from. But it would be preferable to omit this when stdout is redirected.

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