[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Inconsistent External Command Spawning
From: |
Eli Zaretskii |
Subject: |
Re: [bug-gawk] Inconsistent External Command Spawning |
Date: |
Sun, 23 Jun 2013 19:05:27 +0300 |
> Date: Sun, 23 Jun 2013 17:02:43 +0200
> From: Manuel Collado <address@hidden>
> CC: Eli Zaretskii <address@hidden>
>
> I've tested the system/pipe behavior with gawk 4.1.0 from ezwinports.
> There is something weird. system() commands are executed in cmd script
> mode, while pipe commands are executed as top-level console input (sorry
> for the text in spanish):
>
> ---- system-pipe.awk ----------
> function testcommand( command, tmp ) {
> print "Command <" command ">"
> print "System";
> system(command);
> close(command);
> print "Pipe";
> command | getline tmp;
> print tmp;
> close(command);
> print "";
> }
>
> BEGIN {
> testcommand( "ECHO x%1x" )
> testcommand( "ECHO x%TIME%x" )
> testcommand( "for %%K in (uno) do @echo x%%Kx" )
> testcommand( "for %K in (uno) do @echo x%Kx" )
> }
>
> ------------------------------
> I:\pruebas\awk\gawk4>gawk -f system-pipe.awk
> Command <ECHO x%1x>
> System
> xx
> Pipe
> x%1x
>
> Command <ECHO x%TIME%x>
> System
> x16:57:41,34x
> Pipe
> x16:57:41,37x
>
> Command <for %%K in (uno) do @echo x%%Kx>
> System
> xunox
> Pipe
> No se esperaba %%K en este momento.
>
>
> Command <for %K in (uno) do @echo x%Kx>
> System
> No se esperaba Kx en este momento.
> Pipe
> xunox
> -------------------------------
>
> With gawk 4.0.1 both system() and pipe commands are executed in cmd
> script mode.
>
> -------------------------------
> I:\pruebas\awk\gawk4>gawk401 -f system-pipe.awk
> Command <ECHO x%1x>
> System
> xx
> Pipe
> xx
>
> Command <ECHO x%TIME%x>
> System
> x16:59:55,12x
> Pipe
> x16:59:55,17x
>
> Command <for %%K in (uno) do @echo x%%Kx>
> System
> xunox
> Pipe
> xunox
>
> Command <for %K in (uno) do @echo x%Kx>
> System
> No se esperaba Kx en este momento.
> Pipe
> No se esperaba Kx en este momento.
> --------------------------------
I uploaded a fixed binary.