Is it possible to add exit codes?

Issue #13 resolved
Aaditya Bagga created an issue

Hi,

I am trying to find out orphan packages on my system, and using sbbdep --whoneeds over all the packages installed.

However, I noticed that irrespective of whether a package had any reverse dependencies or not, the exit code was always zero.

So would it be possible to add exit codes, such that if the output of sbbdep --whoneeds was blank, it would generate exit code 1, while if there was some output (packages that needed it), the output would be zero.

Regards, Aaditya

$ sbbdep -v sbbdep version 0.2.5

Comments (3)

  1. Harald Achitz repo owner

    Hi Aaditya

    sbbdep uses exit codes, in the way as they are intended to be used http://en.wikipedia.org/wiki/Exit_status

    if package is not required by anyone, this is not an error or failure. so the return value of sbbdep is exit_success http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html

    maybe you just want to check the len of the output, and use the --quite option
    https://bitbucket.org/a4z/sbbdep/wiki/sbbdep options overview to remove noice?

  2. Aaditya Bagga reporter

    Ah, I see.

    Shortly after I opened this bug report, I though of checking the output from sbbdep, and it was blank when package not found.

    What I used:

    out=$(sbbdep --nosync --whoneeds $package); [[ -z "$out" ]] && echo "Possible Orphan $package"

    This produced lots of packages, but its not sbbdep's fault I would say.

    Thx for the help, its solved for me.

  3. Log in to comment