You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a rather elaborate test script in which I want to
write all output of the system under test to a log file, and
write some of it to the shell.
To that end, I wrote a function to which I pipe all output:
work 2>1 | follow_and_log
It looks something like this:
follow_and_log() {
while IFS=$'\n'read -r line;doecho"${line}">>"${logfile}"echo"$(simplify "${line}")"# see attachment for detailsdone
}
Now, this is all good as long as I use echo for printing to the shell:
If I use gum log, however, the scripts hangs on the first log message (kept the echo for illustration):
Well, not the first exactly, but the first whose message I take from the JSON line with jq (see attachment), which is even more curious.
Whatever I do, I've not been able to reproduce this. As you can see in the attachment, what was intended to be an MWE for a bug report has become rather involved, and I don't see a meaningful difference to the real thing anymore (besides the workload being a real program in a different container image, obviously). And it runs swimmingly:
Clearly, I'm missing something, so I guess I'm asking: Any ideas what could go wrong there?
Things I've tried
I suspected control characters somehow being introduced into the JSON line, or by jq, or whatever. Doesn't seem to be the case, though, according to sequin:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a rather elaborate test script in which I want to
To that end, I wrote a function to which I pipe all output:
It looks something like this:
Now, this is all good as long as I use
echo
for printing to the shell:If I use
gum log
, however, the scripts hangs on the first log message (kept theecho
for illustration):Well, not the first exactly, but the first whose message I take from the JSON line with
jq
(see attachment), which is even more curious.Whatever I do, I've not been able to reproduce this. As you can see in the attachment, what was intended to be an MWE for a bug report has become rather involved, and I don't see a meaningful difference to the real thing anymore (besides the workload being a real program in a different container image, obviously). And it runs swimmingly:
Clearly, I'm missing something, so I guess I'm asking: Any ideas what could go wrong there?
Things I've tried
I suspected control characters somehow being introduced into the JSON line, or by jq, or whatever. Doesn't seem to be the case, though, according to
sequin
:Attachments
gum_log_repro.sh
Beta Was this translation helpful? Give feedback.
All reactions