detect when the script exits with error stderr