NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/58955: libedit: rl_event_hook not called when output is piped to another process
The following reply was made to PR lib/58955; it has been noted by GNATS.
From: Michael Rosen <mrrosen%alumni.cmu.edu@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: lib-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: lib/58955: libedit: rl_event_hook not called when output is piped
to another process
Date: Thu, 9 Jan 2025 15:19:31 -0800
--0000000000005d8ece062b4e3676
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
>From my tests, readline works the same for interactive and non-interactive
processes. Just changing the example code to use "#include
<readline/readline.h>" and linking against GNU readline, rl_event_hook is
called periodically in either case.
It's worth noting that GNU readline does rate limit calling rl_event_hook
(the documentation says it will not be called more than 10 times a second
so long as no input is given; so for my example I made the short a char to
not spam the terminal) and that rl_done being set in the rl_event_hook hook
will cause readline() to return, but those differences were less
significant/could be overcome in other ways for my usage (ie, the rate was
unimportant, just that it's called at all, and rl_done behavior can be
achieved by setting rl_event_hook to NULL; but just mentioning).
On Thu, Jan 9, 2025, 1:30=E2=80=AFPM Christos Zoulas via gnats <
gnats-admin%netbsd.org@localhost> wrote:
> The following reply was made to PR lib/58955; it has been noted by GNATS.
>
> From: Christos Zoulas <christos%zoulas.com@localhost>
> To: gnats-bugs%netbsd.org@localhost
> Cc: lib-bug-people%netbsd.org@localhost,
> gnats-admin%netbsd.org@localhost,
> netbsd-bugs%netbsd.org@localhost
> Subject: Re: lib/58955: libedit: rl_event_hook not called when output is
> piped
> to another process
> Date: Thu, 9 Jan 2025 16:25:16 -0500
>
> --Apple-Mail=3D_2E891251-9880-4BC2-8546-5DC03EA3B102
> Content-Transfer-Encoding: quoted-printable
> Content-Type: text/plain;
> charset=3Dus-ascii
>
> I am not sure. How does readline behave? If it works for non-interactive=
=3D
> processes we should change our code.
>
> Best,
>
> christos=3D
>
> --Apple-Mail=3D_2E891251-9880-4BC2-8546-5DC03EA3B102
> Content-Transfer-Encoding: 7bit
> Content-Disposition: attachment;
> filename=3Dsignature.asc
> Content-Type: application/pgp-signature;
> name=3Dsignature.asc
> Content-Description: Message signed with OpenPGP
>
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
>
> iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCZ4A+vAAKCRBxESqxbLM7
> OmyVAJ9kyL1JNCO2qjELSRdcwxYkwxX7OgCdEGXop0mfw3JOMvytJv+j9NN1nKg=3D
> =3DnTPK
> -----END PGP SIGNATURE-----
>
> --Apple-Mail=3D_2E891251-9880-4BC2-8546-5DC03EA3B102--
>
>
--0000000000005d8ece062b4e3676
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto"><div>From my tests, readline works the same for interacti=
ve and non-interactive processes. Just changing the example code to use &qu=
ot;#include <readline/readline.h>" and linking against GNU readl=
ine, rl_event_hook is called periodically in either case.</div><div dir=3D"=
auto"><br></div><div dir=3D"auto">It's worth noting that GNU readline d=
oes rate limit calling rl_event_hook (the documentation says it will not be=
called more than 10 times a second so long as no input is given; so for my=
example I made the short a char to not spam the terminal) and that rl_done=
being set in the rl_event_hook hook will cause readline() to return, but t=
hose differences were less significant/could be overcome in other ways for =
my usage (ie, the rate was unimportant, just that it's called at all, a=
nd rl_done behavior can be achieved by setting rl_event_hook to NULL; but j=
ust mentioning).<br><br><div class=3D"gmail_quote gmail_quote_container" di=
r=3D"auto"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jan 9, 2025, 1:30=
=E2=80=AFPM Christos Zoulas via gnats <<a href=3D"mailto:gnats-admin@net=
bsd.org">gnats-admin%netbsd.org@localhost</a>> wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">The following reply was made to PR lib/58955; it has been not=
ed by GNATS.<br>
<br>
From: Christos Zoulas <<a href=3D"mailto:christos%zoulas.com@localhost" target=3D"=
_blank" rel=3D"noreferrer">christos%zoulas.com@localhost</a>><br>
To: <a href=3D"mailto:gnats-bugs%netbsd.org@localhost" target=3D"_blank" rel=3D"noref=
errer">gnats-bugs%netbsd.org@localhost</a><br>
Cc: <a href=3D"mailto:lib-bug-people%netbsd.org@localhost" target=3D"_blank" rel=3D"n=
oreferrer">lib-bug-people%netbsd.org@localhost</a>,<br>
=C2=A0<a href=3D"mailto:gnats-admin%netbsd.org@localhost" target=3D"_blank" rel=3D"no=
referrer">gnats-admin%netbsd.org@localhost</a>,<br>
=C2=A0<a href=3D"mailto:netbsd-bugs%netbsd.org@localhost" target=3D"_blank" rel=3D"no=
referrer">netbsd-bugs%netbsd.org@localhost</a><br>
Subject: Re: lib/58955: libedit: rl_event_hook not called when output is pi=
ped<br>
=C2=A0to another process<br>
Date: Thu, 9 Jan 2025 16:25:16 -0500<br>
<br>
=C2=A0--Apple-Mail=3D_2E891251-9880-4BC2-8546-5DC03EA3B102<br>
=C2=A0Content-Transfer-Encoding: quoted-printable<br>
=C2=A0Content-Type: text/plain;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 charset=3Dus-ascii<br>
<br>
=C2=A0I am not sure. How does readline behave? If it works for non-interact=
ive =3D<br>
=C2=A0processes we should change our code.<br>
<br>
=C2=A0Best,<br>
<br>
=C2=A0christos=3D<br>
<br>
=C2=A0--Apple-Mail=3D_2E891251-9880-4BC2-8546-5DC03EA3B102<br>
=C2=A0Content-Transfer-Encoding: 7bit<br>
=C2=A0Content-Disposition: attachment;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 filename=3Dsignature.asc<br>
=C2=A0Content-Type: application/pgp-signature;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 name=3Dsignature.asc<br>
=C2=A0Content-Description: Message signed with OpenPGP<br>
<br>
=C2=A0-----BEGIN PGP SIGNATURE-----<br>
=C2=A0Comment: GPGTools - <a href=3D"http://gpgtools.org" rel=3D"noreferrer=
noreferrer" target=3D"_blank">http://gpgtools.org</a><br>
<br>
=C2=A0iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCZ4A+vAAKCRBxESqxbLM7<br>
=C2=A0OmyVAJ9kyL1JNCO2qjELSRdcwxYkwxX7OgCdEGXop0mfw3JOMvytJv+j9NN1nKg=3D<br=
>
=C2=A0=3DnTPK<br>
=C2=A0-----END PGP SIGNATURE-----<br>
<br>
=C2=A0--Apple-Mail=3D_2E891251-9880-4BC2-8546-5DC03EA3B102--<br>
<br>
</blockquote></div></div></div>
--0000000000005d8ece062b4e3676--
Home |
Main Index |
Thread Index |
Old Index