#!/usr/bin/env bash set -eu args=("$@") if [ -n "$ZREPL_MOCK_ZFS_COMMAND_LOG" ]; then ( flock -x 200 jq --compact-output -n --argjson args "$(printf '%s\0' "${args[@]}" | jq -Rsc 'split("\u0000")')" '{date: now|strflocaltime("%Y-%m-%dT%H:%M:%S"), command: $args}' >> "$ZREPL_MOCK_ZFS_COMMAND_LOG" ) 200>"$ZREPL_MOCK_ZFS_COMMAND_LOG".lock fi exec "$ZREPL_MOCK_ZFS_PATH" "${args[@]}"