#!/usr/bin/bash
# remote helper using tcp port
# will be called by grob-client

set -o pipefail
[ -n "${GROB_OTP-}" ] || {
    echo "$0: fatal error: GROB_OTP undefined or empty" >&2
    exit 251
}
[ -n "${GROB_TUNNEL_PORT-}" ] || {
    echo "$0: fatal error: GROB_TUNNEL_PORT undefined or empty" >&2
    exit 252
}
{ echo "$GROB_OTP"; cat; } | \
    socat STDIO TCP-CONNECT:localhost:"$GROB_TUNNEL_PORT"
