aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-07-11 12:51:43 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-07-11 12:51:43 +0200
commit39aabfe8f033c9c62acf676b660dc979714d26a7 (patch)
treec6d6cc7445850240bebe9deddddd124d9e5453e8
parent4ef8841b21e27e7c7f58d3c9901c833b4fa5a862 (diff)
downloadbusybox-w32-39aabfe8f033c9c62acf676b660dc979714d26a7.tar.gz
busybox-w32-39aabfe8f033c9c62acf676b660dc979714d26a7.tar.bz2
busybox-w32-39aabfe8f033c9c62acf676b660dc979714d26a7.zip
awk: unbreak "cmd" | getline
function old new delta evaluate 3337 3343 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/awk.c3
-rwxr-xr-xtestsuite/awk.tests5
2 files changed, 7 insertions, 1 deletions
diff --git a/editors/awk.c b/editors/awk.c
index e765d3fcf..6c60a0615 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -3156,7 +3156,8 @@ static var *evaluate(node *op, var *res)
3156 if (op1) { 3156 if (op1) {
3157 rsm = newfile(L.s); 3157 rsm = newfile(L.s);
3158 if (!rsm->F) { 3158 if (!rsm->F) {
3159 if (opinfo == TI_PGETLINE) { 3159 /* NB: can't use "opinfo == TI_PGETLINE", would break "cmd" | getline */
3160 if ((opinfo & OPCLSMASK) == OC_PGETLINE) {
3160 rsm->F = popen(L.s, "r"); 3161 rsm->F = popen(L.s, "r");
3161 rsm->is_pipe = TRUE; 3162 rsm->is_pipe = TRUE;
3162 } else { 3163 } else {
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 6b23b91cb..242c897d1 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -455,4 +455,9 @@ testing "awk print + redirect" \
455 "STDERR %s\n" \ 455 "STDERR %s\n" \
456 '' '' 456 '' ''
457 457
458testing "awk \"cmd\" | getline" \
459 "awk 'BEGIN { \"echo HELLO\" | getline; print }'" \
460 "HELLO\n" \
461 '' ''
462
458exit $FAILCOUNT 463exit $FAILCOUNT