"man gawk" (for Gawk 5.0) says:
PROCINFO["command", "pty"]
Use a pseudo-tty for two-way communication with
command instead of setting up two one-way pipes.
Prior to that, it says "These variables may be set to control ...", but doesn't really say what to set them to. Normally, this sort of phrasing implies that setting them to anything - i.e., just causing them to exist - will qualify as "being set".
However, experimentation shows that here, the variable needs to be set to a non-zero value in order to take effect. If is set to 0 or "", it will not use a pty.
Use the following program to test:
$ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"];cmd |& getline;print }'
not a tty
$ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"]=0;cmd |& getline;print }'
not a tty
$ gawk 'BEGIN { cmd="tty";PROCINFO[cmd,"pty"]=1;cmd |& getline;print }' /dev/pts/N
This should either be fixed in the documentation or fixed in the code
(i.e., the code changed so that merely setting it is enough).
On 01.02.2022 14:15, Kenny McCormack wrote:...
"man gawk" (for Gawk 5.0) says:
PROCINFO["command", "pty"]
Use a pseudo-tty for two-way communication with
command instead of setting up two one-way pipes.
Prior to that, it says "These variables may be set to control ...", but
doesn't really say what to set them to. Normally, this sort of phrasing
implies that setting them to anything - i.e., just causing them to exist - >> will qualify as "being set".
Just a nitpick...
PROCINFO["command", "pty"] makes it already "exist", just its value
The 'set' state is indeed irrelevant, and using that word misleading,
I agree.
The general point of this thread is that it is impossible to figure out
what works (I.e., what you have to do) from the text. You have to resort
to experimentation to figure it out.
For me, the issue is that I use this particular bit of functionality so rarely that I have to look it up each time, and then end up doing the experiments all over again each time.
"man gawk" (for Gawk 5.0) says:
PROCINFO["command", "pty"]
Use a pseudo-tty for two-way communication with
command instead of setting up two one-way pipes.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 829 |
Nodes: | 10 (1 / 9) |
Uptime: | 112:19:26 |
Calls: | 11,468 |
Calls today: | 7 |
Files: | 186,240 |
Messages: | 1,815,060 |