diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-11-18 21:04:25 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-11-18 21:04:25 +0200 |
commit | dc2613b0af11a8cf97232d55c322d40eda35c224 (patch) | |
tree | 9b010226dd4298a311118b4a555f2c395649de40 /test/iolint.awk | |
parent | 5fd15d010b98f179d117eb3a476e626b3d298aad (diff) | |
download | egawk-dc2613b0af11a8cf97232d55c322d40eda35c224.tar.gz egawk-dc2613b0af11a8cf97232d55c322d40eda35c224.tar.bz2 egawk-dc2613b0af11a8cf97232d55c322d40eda35c224.zip |
Restore removed test in test/iolint.awk.
Diffstat (limited to 'test/iolint.awk')
-rw-r--r-- | test/iolint.awk | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/test/iolint.awk b/test/iolint.awk index 58fd746f..042f743b 100644 --- a/test/iolint.awk +++ b/test/iolint.awk @@ -55,15 +55,20 @@ BEGIN { print close("cat") fflush() - # 11/2021: Disable this test since it's a race condition - # and fails intermittently on some systems. + # 11/2021: Use a nice trick to avoid race conditions in + # child processes. Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>. # # `%.*s' used for input pipe and output pipe - # "echo hello" | getline junk - # print "hello" | "echo hello" - # print close("echo hello") - # print close("echo hello") - # fflush() + pipecmd = "eval $CMD_TO_RUN" + + ENVIRON["CMD_TO_RUN"] = "echo hello" + pipecmd | getline junk + ENVIRON["CMD_TO_RUN"] = "read junk" + print "hello" | pipecmd + + print close(pipecmd) + print close(pipecmd) + fflush() # `%.*s' used for output file and output pipe" BINMODE = 2 |