generate_apple_*_selection_file: Add option to capture errors Add an option to capture error messages in a variable instead of terminating with a fatal error. Fixes: #25778