Skip to content

Wishlist: Use command's exitcode for PASS/FAIL handling? #241

Description

@pjotrek-b

Hi everyone 😄

I've read the Documentation on How To Use MediaConch, and was wondering if it's possible to have MediaConch return a non-zero exit-code to let the caller (CLI) know if a policy file was PASS or FAIL?

AFAI understood, the current way to do so is to parse the mconch-report output format (xml, json, etc), right?

Curious on your opinions!

Activity

  1. kieranjol commented on Jan 8, 2026

    @kieranjol
  2. JeromeMartinez commented on Jan 8, 2026

    @JeromeMartinez
    Member

    We imagined exit code for MediaConch for MediaConch itself, but true that it deserves to directly provide the PASS or FAIL.

  3. pjotrek-b commented on Jan 15, 2026

    @pjotrek-b
    Author

    @JeromeMartinez : sure, the exitcodes shall (still) be for MediaConch itself!

    I was thinking along something similar to rsync (see below), where its documentation lists several different exit values for different "feeback" to the caller.

    So would it be possible to have something like this for MediaConch?

    • 0 Success
    • 1 Syntax or usage error
    • ...
    • 20 PASS
    • 21 FAIL

    Of course the numbers are arbitrary. Just an idea 😎

    Example from rsync:

    (see: man rsync; almost at the very bottom)

    EXIT VALUES
           0      Success
           1      Syntax or usage error
           2      Protocol incompatibility
           3      Errors selecting input/output files, dirs
           4      Requested action not supported: an attempt was made  to  manipu‐
                  late  64-bit files on a platform that cannot support them; or an
                  option was specified that is supported by the client and not  by
                  the server.
           5      Error starting client-server protocol
           6      Daemon unable to append to log-file
           10     Error in socket I/O
           11     Error in file I/O
           12     Error in rsync protocol data stream
           13     Errors with program diagnostics
           14     Error in IPC code
           20     Received SIGUSR1 or SIGINT
           21     Some error returned by waitpid()
           22     Error allocating core memory buffers
           23     Partial transfer due to error
           24     Partial transfer due to vanished source files
           25     The --max-delete limit stopped deletions
           30     Timeout in data send/receive
           35     Timeout waiting for daemon connection
    
  4. pjotrek-b commented on Jan 15, 2026

    @pjotrek-b
    Author

    I've had the case now where the user can configure to generate different mediaconch output files (JSON, txt) to go into preservation.

    Thanks to mconch allowing multiple files at the same time, I now add:
    --Output-simple=/tmp/mediaconch_failpass.txt
    ... which I then use in my code to know if it's FAIL or PASS. 🤓 🥳

    (Finally adding this as MediaConch and MediaInfo Tasks to CInbox for born-digital ingest right now 🍰 😁)

    Jerômé, these are such great and invaluable tools! Thank you so much!

  5. retokromer commented on Jan 15, 2026

    @retokromer
    Contributor

    see: man rsync; almost at the very bottom

    😂 It’s actually the position in a man where this type of information is supposed to be found.

  6. retokromer commented on Jan 15, 2026

    @retokromer
    Contributor

    Stricto sensu, there should be no difference between “success” and PASS, both should be the value 0, or am I missing something?

  7. JeromeMartinez commented on Jan 15, 2026

    @JeromeMartinez
    Member

    Stricto sensu, there should be no difference between “success” and PASS, both should be the value 0, or am I missing something?

    Right, 0 would be "Success AND pass".

  8. pjotrek-b commented on Jan 16, 2026

    @pjotrek-b
    Author

    So, what about:

    • 0 = pass
    • 1 = fail
    • x = ... other non-success issue (syntax or usage or runtime errors, etc)

    Then pass+fail would be next to each other 😄

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions