Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: one time in 20 error



On Mon, Nov 28, 2022 at 9:34 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2022-11-28 09:54, Roman Perepelitsa wrote:
> >
> > This might be a response by the TTY to a query that your script has
> > sent to it. Basically, if the script queries the TTY and exits before
> > reading the response, then the response goes to zle and you see this
> > kind of garbage on the command line.
> >
> > ^[[<0;24;4m is a CSI sequence. I don't remember its meaning from the
> > top of my head.
>
> I thought it might be something of that general nature.  I wonder, is
> there some strategic place where I might put a 'sleep' to let things
> sort themselves out?  Probably only would take a millisecond or two.

You can try this:

    () {
      zmodload zsh/system
      local REPLY
      while sysread -t 0.1; do done
    }

This reminds me of a student in a C programming class who was
frustrated by the pesky "core dumped" message printed after his
program succeeded. He redirected stderr to /dev/null
and--Voilà--problem solved!

The teacher wasn't convinced by this "solution" and neither should you.

Roman.




Messages sorted by: Reverse Date, Date, Thread, Author