consul-locker
consul-locker copied to clipboard
Output from script is lost
When running things in the background, messages can appear in your terminal.
( sleep 1; echo "output"; ) &
But you can't redirect to a file.
( sleep 1; echo "output"; ) & > test-output
It does work if you can rearrange the order
( sleep 1; echo "output"; ) > test-output &
The trouble is that we want to get consul-locker to preserve the script's stdout and stderr. Line 274 is where the other command is executed in the background. Now I guess I need a trick to preserve stdout and stderr or else find another way to structure this bit of code so that errors from consulSessionRenew can be returned. Perhaps the simplest answer is to call consulSessionRenew once, report if it has an error, then fork the loop and do not report if any subsequent calls have errors.