#!/bin/sh : $(srcdir=.) source "$srcdir/init.sh"; path_prepend_ . echo Hello world > in.tmp echo world > xout.tmp setglobal fail = '0' # Test with seekable stdin; follow-on process must see remaining data shell {test-closein; cat} < in.tmp > out1.tmp || setglobal fail = '1' cmp out1.tmp in.tmp || setglobal fail = '1' shell {test-closein consume; cat} < in.tmp > out2.tmp || setglobal fail = '1' cmp out2.tmp xout.tmp || setglobal fail = '1' # Test for lack of error on pipe. Ignore any EPIPE failures from cat. cat in.tmp !2 >/dev/null | test-closein || setglobal fail = '1' cat in.tmp !2 >/dev/null | test-closein consume || setglobal fail = '1' # Test for lack of error when nothing is read test-closein /dev/null && setglobal fail = '1' Exit $fail