changed || to |& for bidirectional piping
This commit is contained in:
@ -25,7 +25,8 @@ check_ERRORS = e-001.err
|
||||
EXTRA_DIST = $(check_SCRIPTS) $(check_ERRORS) tap.inc err.sh \
|
||||
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \
|
||||
bibtex-to-html.hawk bibtex-to-html.out \
|
||||
fs-test.hawk fs-test.in fs-test.out
|
||||
fs-test.hawk fs-test.in fs-test.out \
|
||||
two-way-pipe.hawk two-way-pipe.out
|
||||
|
||||
check_PROGRAMS = t-001 t-002 t-003 t-004 t-005 t-006 t-007 t-008 t-009
|
||||
|
||||
|
@ -649,7 +649,8 @@ check_ERRORS = e-001.err
|
||||
EXTRA_DIST = $(check_SCRIPTS) $(check_ERRORS) tap.inc err.sh \
|
||||
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \
|
||||
bibtex-to-html.hawk bibtex-to-html.out \
|
||||
fs-test.hawk fs-test.in fs-test.out
|
||||
fs-test.hawk fs-test.in fs-test.out \
|
||||
two-way-pipe.hawk two-way-pipe.out
|
||||
|
||||
t_001_SOURCES = t-001.c tap.h
|
||||
t_001_CPPFLAGS = $(CPPFLAGS_COMMON)
|
||||
|
@ -81,6 +81,7 @@ function main()
|
||||
run_test("journal-toc", "-vHTML=1", "journal-toc", 0, "journal-toc-html");
|
||||
run_test("bibtex-to-html", "", "journal-toc", 1, "bibtex-to-html");
|
||||
run_test("fs-test", "", "fs-test", 0, "fs-test");
|
||||
run_test("two-way-pipe", "", @nil, 0, "two-way-pipe");
|
||||
|
||||
tap_end ();
|
||||
}
|
||||
|
10
t/two-way-pipe.hawk
Normal file
10
t/two-way-pipe.hawk
Normal file
@ -0,0 +1,10 @@
|
||||
BEGIN {
|
||||
cmd = "sort";
|
||||
data = hawk::array("hello", "world", "two-way pipe", "testing");
|
||||
|
||||
for (i = 1; i <= length(data); i++) print data[i] |& cmd;
|
||||
close(cmd, "to");
|
||||
|
||||
while ((cmd |& getline line) > 0) print line;
|
||||
close(cmd);
|
||||
}
|
4
t/two-way-pipe.out
Normal file
4
t/two-way-pipe.out
Normal file
@ -0,0 +1,4 @@
|
||||
hello
|
||||
testing
|
||||
two-way pipe
|
||||
world
|
Reference in New Issue
Block a user