If you wait until a dog is actually attacking a child, you have waited much too long. While pepper spray might work,MoJo wrote:I am not going to shoot a dog unless it is actually attacking.:
I would be concerned that it might not. Being in a yard with child, an angry aggressive peppery dog and my hand holding a spray canister doesn't fill me with confidence. If you honestly think the threat is real, protecting the child is all that matters. I would put the dog down.