Pepper spray or a gun? In a bear attack, which one wins the fight?

Where do you stand on the debate?  Would a person have a better chance of surviving a bear attack by deploying pepper spray or using a gun?