#!/bin/bash

# custom override example
stat_busy() {
	if (( PUSH_MSG )); then
		# This triggers the error in "$@" below
		# actual code was:
		# echo set message "$1" > "$spl_fifo" &
		: &
	fi
	echo "$1" BUSY
}

status() {
	stat_busy "$1"
	shift
	"$@"
	local retval=$?
	(( retval == 0 )) && echo DONE || echo FAIL "($retval)"
}

PUSH_MSG=0 status "test #0" cat <(echo foo)
PUSH_MSG=1 status "test #1" cat <(echo foo)

