I'm not a strong believer in all the Kenpo weapons techniques, but I do like the one for this attack, Twisted Rod.
So first of all, if a perp is stupid enough to get within striking range with a pistol, it wouldn't be too hard to get off the line IF you're fast enough. I'm much less afraid of guns at this range than knives (1 pound of poop vs. 2) since really only the very tip of the thing is dangerous, and if you can keep the muzzle pointed away from you, you're actually in pretty good shape, except for your ears from the report.
The way I do Twisted Rod is (prefix--create a distraction, ex. say something confusing like "your sister does indeed like lima beans," to buy a quarter-second, then a) get off the line while closing the gap b) check the gun hand with your right hand c) throw the figure-4 lock on with the left and right, then shift hips to really engage the lock and unbalance the BG.
That's the first couple, most important moves, and with practice they can be launched faster than the perp can pull the trigger. The way the lock is applied results in the muzzle pointing at the BG's face, secured with your palm over the back of his hand.
Grabbing the barrel of a automatic first rather than the hand to keep it from discharging or hoping that it would stovepipe a round in the ejection port IMHO is probably not a good idea. First of all, most modern automatics don't have very long barrels. My 1911 does, but it's one of the few. So you run the risk of getting a digit shot off, and losing control of the weapon because it's slippery now. After you get control of the hand and muzzle direction, then you can slide your hand onto the barrel since he won't want the gun to go off when it's pointed at the center of his face.
Secondly, I really doubt that I could hang onto the barrel of a high-powered automatic when it was discharging. There's a strong recoil, plus I'd get burned, which typically makes me flinch away, and again I've lost control of the gun.
Lonewolf, I liked the last part of posted technique with the armbar, but as I think someone here mentioned, the first part of the technique still allows a fair amount of articulation with the wrist/gun.