forked from rook/rook
find_extra_block_dev piped find_extra_block_devs into head -1. Since find_extra_block_devs prints every eligible disk and ends with echo "$devs", head closes the pipe after the first line and the producer's echo races into SIGPIPE (echo: write error: Broken pipe), failing the command substitution under pipefail/errexit. The race only fires reliably now that the runners present two data disks (sdb and sdc), so find_extra_block_devs emits multiple lines; with a single disk the one-line output almost never triggered it. Read the producer to completion with mapfile via process substitution and return the first element, mirroring find_second_block_dev, so there is no downstream head to close the pipe early. Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>