# execute the command in a subshell, meaning our env/functions are available.
# the trap signal will catch the SIGHUP and SIGINT signals and ignore them.
# we disconnect our forked process from stdin by pointing stdin to /dev/null.
# we point stderr and stdout to `$tmpdir/nohup.log` and we mark this command to
# be executed asynchronously with `&`.
# see: https://overflow.adminforge.de/questions/16435629/#54688673
exec_nohup() {
  (
    trap '' HUP INT
    "$@"
  ) </dev/null &>>"${TMPDIR:-/tmp}/hook.log" &
}
