Skip to content

Do not exit with status code 1 for IO errors #354

@sharkdp

Description

@sharkdp

We currently exit with code 1 in cases of IO errors:

▶ ty check non-existent-file.py
WARN No python files found under the given path(s)
error[io]: `/home/shark/non-existent-file.py`: No such file or directory (os error 2)

Found 1 diagnostic

▶ echo $?
1

This is undesirable because it mixes actual diagnostics in the users code (type-checking problems) with problems when performing the check. It is useful for users to be able to distinguish these two cases.

Similarly, as @MichaReiser pointed out in a conversation, it is unlikely that someone would want to suppress IO errors using --exit-zero, but that is exactly what happens right now:

▶ ty check non-existent-file.py --exit-zero 
WARN No python files found under the given path(s)
error[io]: `/home/shark/non-existent-file.py`: No such file or directory (os error 2)

Found 1 diagnostic

▶ echo $?
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliRelated to the command-line interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions