#!/bin/sh # Regression for issue #948: when the reader closes a fifo, the writer should # get existence_error(stream, ...) from portray_clause/2 rather than keep # writing forever. A follow-on bug left portray_clause's fullstop/nl flags # set across the throw, so the exception ball was printed as # "error(...).\n." and parse_to_heap then reported a spurious syntax error. set -e TPL=${TPL:-./tpl} DIR=$(mktemp -d) trap 'rm -rf "$DIR"' EXIT mkfifo "$DIR/fifo" cat > "$DIR/writer.pl" < "$DIR/reader.pl" <"$DIR/w.out" 2>"$DIR/w.err" & WPID=$! sleep 0.3 timeout 20 "$TPL" -q -f -g halt "$DIR/reader.pl" >"$DIR/r.out" 2>"$DIR/r.err" wait "$WPID" || true echo "--- reader ---" head -c 500 "$DIR/r.out" echo echo "--- writer ---" head -c 500 "$DIR/w.out" echo echo "--- writer stderr ---" # Empty is the pass: any leftover "Error: syntax error..." fails the golden. head -c 500 "$DIR/w.err"