Skip to content

Exit code unchanged when an error is encountered #27

Closed

Description

@tavianator

E.g.

$ mkdir foo
$ chmod -rwx foo
$ ./target/debug/find foo
foo
Error: foo: permission denied
$ echo $?
0
$ find foo
foo
find: ‘foo’: Permission denied
$ echo $?
1

Activity

  1. hanbings commented on Apr 6, 2024

    @hanbings
    Collaborator

    We handle errors caused by reading files in process_dir(), which conforms to the processing logic of GNU find. But internal errors that would cause process_dir() to be handled cannot be passed to the outer layer. Therefore adding a boolean error flag is used to pass a signal to the upper function to change the exit code when process_dir() has any error.

    It might solve the problem, even if it's not very elegant :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions