Allow CLI api to specify exit code

Bug #1275617 reported by Aaron Wells on 2014-02-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Aaron Wells

Bug Description

I just noticed a bug in the (rarely used) command-line API for Mahara. The function cli->cli_print_help() is supposed to allow you to include an exit code, i.e. an integer to pass as the Unix exit value for the process. However, the way cli->cli_exit() is written, you can't actually specify a raw exit code. Instead, only booleans are accepted.

I've written a small fix to cli_exit() to make it so that if the param is an int, we pass that raw int as the exit code, and if the param is a boolean, we use that to determine whether to pass 0 (success) or 127 (failure).

Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 8725ae5da3927a2addaade20ea620d4a51a71b1a
Author: Aaron Wells <email address hidden>
Date: Mon Feb 3 17:56:30 2014 +1300

Allow CLI api to directly specify Unix process return code

Bug1275617. Existing code only accept a boolean value for the $error
parameter, and return 0 or 127 for success or failure. This patch
allows you to pass an int for the $error parameter, in which case
that int is used as the return code. If you pass a boolean, we use
the old 0/127 behavior.

Change-Id: I96637f9c896184dc36c51bb968284f47f4fbc864

Robert Lyon (robertl-9) on 2014-02-25
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2014-04-22
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers