Skip to content

Commit f44932b

Browse files
author
Ataxexe
committed
pass the output instead of exit code (is more useful)
1 parent 5b30113 commit f44932b

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ The builtin events are:
102102

103103
* **start** - before the task execution
104104
* **finish** - after the task execution
105-
* **fail** *(exit code)* - when a command fails to execute (broadcasted by *execute* and *check* functions)
105+
* **fail** *(output)* - when a command fails to execute (broadcasted by *execute* and *check* functions)
106106

107107
## Quick Tasks
108108

@@ -256,7 +256,7 @@ Checks if the previous command returned successfully and logs the result using t
256256

257257
### execute (description, command, [*args])
258258

259-
Executes a command and checks if it was sucessfull. The output will be stored in the variable *$LAST_EXECUTION_OUTPUT* and the result will be .
259+
Executes a command and checks if it was sucessfull. The output will be stored in the variable *$LAST_EXECUTION_OUTPUT* and the code in *${LAST_EXECUTION_CODE}*.
260260

261261
execute "Pushing commits" git push
262262
# outputs according to exit code:

scripts/core.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2323
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424

25-
SODA_VERSION="1.3.0"
25+
SODA_VERSION="1.4.0"
2626

2727
# Stores the usage for exposed commands
2828
TASKS_USAGE=" TASKS:"

scripts/soda/exec.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ execute() {
114114
shift
115115
printf "%-60s " "$description"
116116
LAST_EXECUTION_OUTPUT="$("$@" 2>&1)"
117+
LAST_EXECUTION_CODE="${code}"
117118
code="$?"
118119
if [[ $code == 0 ]]; then
119120
printf "[ %s ]\n" "$(green "OK")"
@@ -122,7 +123,7 @@ execute() {
122123
else
123124
printf "[ %s ]\n" "$(red "FAIL")"
124125
file_log "FAIL" "$description"
125-
broadcast "fail" "$code"
126+
broadcast "fail" "$LAST_EXECUTION_OUTPUT"
126127
return 1
127128
fi
128129
}

0 commit comments

Comments
 (0)