awk: unbreak "cmd" | getline
function old new delta evaluate 3337 3343 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
4ef8841b21
commit
39aabfe8f0
@ -3156,7 +3156,8 @@ static var *evaluate(node *op, var *res)
|
|||||||
if (op1) {
|
if (op1) {
|
||||||
rsm = newfile(L.s);
|
rsm = newfile(L.s);
|
||||||
if (!rsm->F) {
|
if (!rsm->F) {
|
||||||
if (opinfo == TI_PGETLINE) {
|
/* NB: can't use "opinfo == TI_PGETLINE", would break "cmd" | getline */
|
||||||
|
if ((opinfo & OPCLSMASK) == OC_PGETLINE) {
|
||||||
rsm->F = popen(L.s, "r");
|
rsm->F = popen(L.s, "r");
|
||||||
rsm->is_pipe = TRUE;
|
rsm->is_pipe = TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -455,4 +455,9 @@ testing "awk print + redirect" \
|
|||||||
"STDERR %s\n" \
|
"STDERR %s\n" \
|
||||||
'' ''
|
'' ''
|
||||||
|
|
||||||
|
testing "awk \"cmd\" | getline" \
|
||||||
|
"awk 'BEGIN { \"echo HELLO\" | getline; print }'" \
|
||||||
|
"HELLO\n" \
|
||||||
|
'' ''
|
||||||
|
|
||||||
exit $FAILCOUNT
|
exit $FAILCOUNT
|
||||||
|
Loading…
Reference in New Issue
Block a user