|
From: Andrew J. S. <as...@te...> - 2023-08-21 10:30:21
|
Hi,
This is not a bug. Please set XMLMODE=0 and see that it works.
Without that, it is trying to parse the output from sort as XML
data.
Regards,
Andy
On Thu, Aug 17, 2023 at 09:23:57PM +0200, Jürgen Kahrs via Gawkextlib-users wrote:
> Hello,
>
> the following posting looks like a reasonable question to our list.
> For some unknown reason it was auto-discarded by the mail server.
> Therefore I am re-posting it myself with a copy going to the author.
>
> The origin of the problem probably is that the loading of the XML extension
> switches the behaviour of the interpreter when processing two-way I/O.
> To the best of my knowledge, this is intended and documented somewhere.
>
> Jürgen Kahrs
>
>
> Hi everyone,
>
> I'm a huge fan of the xml Extension for gawk. Great stuff!
> Recently I noticed that I cannot open another process within gawk when the
> xml extension is loaded (Two-way I/O (The GNU Awk User’s Guide)
>
> Simple script to reproduce (I basically took the example from the man
> page):
>
> Does not work:
>
> @load "xml"
> BEGIN {
> command = "LC_ALL=C sort"
> n = split("abc", a, "")
>
> for (i = n; i > 0; i--)
> print a[i] |& command
> close(command, "to")
>
> while ((command |& getline line) > 0)
> print "got", line
> close(command)
> }
>
> Works (notice the "@load" Statement is commented)
>
> #@load "xml"
> BEGIN {
> command = "LC_ALL=C sort"
> n = split("abc", a, "")
>
> for (i = n; i > 0; i--)
> print a[i] |& command
> close(command, "to")
>
> while ((command |& getline line) > 0)
> print "got", line
> close(command)
> }
>
> Interestingly enough if I load other extensions (e.g @load "json") it is no
> problem.
> It seems to be an issue specifically with xml.
>
> Am I doing something wrong here? Can anyone confirm?
> Maybe this was already reported
>
> Versions I used:
> □ GNU Awk 5.2.2
> □ XML: 1.1.1
> Greetings
> Joseph
>
>
>
>
> _______________________________________________
> Gawkextlib-users mailing list
> Gaw...@li...
> https://lists.sourceforge.net/lists/listinfo/gawkextlib-users
--
Andrew Schorr e-mail: as...@te...
Telemetry Investments, L.L.C. phone: 917-305-1748
152 W 36th St, #402 fax: 212-425-5550
New York, NY 10018-8765
|