In the following code, I have to poll $tmp_input
to continue executing the code because wezterm cli send-text
is asynchronous. This makes sure that $tmp_input
is ready.
tmp_input=$(mktemp ./tmp_input.XXXXXX)
echo "read input; echo \$input > $tmp_input" | wezterm cli send-text --pane-id $bottom_pane_id --no-paste
while [ ! -s "$tmp_input" ]; do
sleep 1
done
input_value=$(cat "$tmp_input")
rm "$tmp_input"
echo "Input was: $input_value" | wezterm cli send-text --pane-id $bottom_pane_id --no-paste
The code works, but I was wondering if there is another way of accomplishing the same result.