Confirmed. feeding the pipe some dummy text (with an implicit EOF) before removing it causes the script to exit correctly:
Code:
cleanup()
{
if [ ${compress:-N} = Y ]
then
echo "fail" >> ${pipe_name}
rm -f ${pipe_name}
fi
}
Presumably the issue is coming from the gzip command not returning an exit code to the script process before it disappears, keeping the script process open. Killing the pipe before it feeds the gzip process anything seems to leave the script process in limbo. Feeding the dummy text is an OK workaround but it leaves me with the .gz file after a failure.
Does anyone know how to send JUST the EOF to a pipe? I'm hoping that this will cause the background gzip process to exit cleanly without creating a .gz file.