From: Matthias Kruk Date: Thu, 15 Apr 2021 23:27:31 +0000 (+0900) Subject: include/inst: Make inst_stop emit a meaningful message upon error X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=eb3d6f97936dce487812464bda03de139a3eae8c;p=toolbox include/inst: Make inst_stop emit a meaningful message upon error Instead of emitting a user-understandable error message, the inst_stop() function merely lets an error message from the sem module slip through. This commit changes the function to emit an error message that tells the caller why exactly the function failed. --- diff --git a/include/inst.sh b/include/inst.sh index d20a8c5..8e900f5 100644 --- a/include/inst.sh +++ b/include/inst.sh @@ -91,7 +91,8 @@ inst_stop() { sem="$__inst_path/$pid" - if ! sem_post "$sem"; then + if ! sem_post "$sem" &> /dev/null; then + log_error "No such instance" return 1 fi