diff options
author | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-18 09:56:28 +0100 |
---|---|---|
committer | Lucía Andrea Illanes Albornoz <lucia@luciaillanes.de> | 2023-03-18 09:56:28 +0100 |
commit | 670f66a5e1804519e1e1b4554915b7c7da6b72b0 (patch) | |
tree | 0deb4096f8651a67681d3ee8a0b487cccf69a3ad /subr.ex/ex_pkg_dispatch.subr | |
parent | 6382f7e4509eae5fc1e86aedef5fde7fbb733ca8 (diff) | |
download | midipix_build-670f66a5e1804519e1e1b4554915b7c7da6b72b0.tar.bz2 midipix_build-670f66a5e1804519e1e1b4554915b7c7da6b72b0.tar.xz |
Safely send dispatcher messages.
Diffstat (limited to 'subr.ex/ex_pkg_dispatch.subr')
-rw-r--r-- | subr.ex/ex_pkg_dispatch.subr | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/subr.ex/ex_pkg_dispatch.subr b/subr.ex/ex_pkg_dispatch.subr index 1274aa64..217bd360 100644 --- a/subr.ex/ex_pkg_dispatch.subr +++ b/subr.ex/ex_pkg_dispatch.subr @@ -380,4 +380,23 @@ ex_pkg_dispatch() { return "${_epd_rc}"; }; +# +# ex_pkg_dipatch_send() - send message from dispatcher child process to dispatcher parent process across FIFO +# @_op: message operation string +# +# Return: zero (0) invariably. +# +ex_pkg_dispatch_send() { + local _epds_op="${1}"; + shift 1; + + trap '' PIPE; + while ! printf "%s%s\n" "${_epds_op}" "${*:+ "${*}"}" 1>&3 2>/dev/null; do + :; + done; + trap - PIPE; + + return 0; +}; + # vim:filetype=sh textwidth=0 |