I have the following lftp script to copy files from a remote to local:
env TERM=dumb script -a $LOGSTDOUT -c "$(cat <<- EOF
    lftp $PROTOCOL://$URL -u ${USER},${PASS} << EOFF
    set dns:fatal-timeout never
    set sftp:auto-confirm yes
    set mirror:use-pget-n 50
    set mirror:parallel-transfer-count 2
    set mirror:parallel-directories yes
    set mirror:include-regex $REGEX
    set log:enabled/xfer yes
    set log:file/xfer $LOG
    set xfer:use-temp-file yes
    set xfer:temp-file-name *.lftp
    mirror -c -v --loop --Remove-source-dirs "$REMOTEDIR" "$LOCALDIR"
    quit
    EOFF
EOF
)"

I am capturing terminal output with the script(1) utility. The env TERM=dumb is just a random piece of code I found to disable ANSI escape codes.
My problem is that the line breaks of the output log file get quiet mangled. It seems to be using CR and LF. I discovered more information here and it seems this is by design. Though I'm not sure how to fix it.
These line endings cause issues when viewing the logs in lnav:

The reason for this becomes quickly apparent upon inspecting the raw text:

I have thought of some potential options, but not sure how to implement:

Fix the output of the script(1) utility so that single CR are converted to LF. Maybe this can be achieved with piping or some arguement?
A hack for lnav to treat CR as LF when displaying in the GUI.

Anyone know how I can fix these line breaks so it shows correctly in lnav?

How can I fix line breaks output by script(1) utility?
Try replacing
... script -a $LOGSTDOUT ...

with
... script -a >(tr -d '\r' >"$LOGSTDOUT") ...


See the Process Substitution section on the Bash Reference Manual for an explanation of >(...).
Note that ALL_UPPERCASE variable names (like LOGSTDOUT) are best avoided because there is a danger of clashes with the large number of special ALL_UPPERCASE variables that are used in shell programming.  See Correct Bash and shell script variable capitalization.
The quotes on $LOGSTDOUT are necessary in general.  Use Shellcheck to find common problems with shell code, including missing quotes.

