If it's going to nuke vim's undo files, it can't hide behind "another program".
If that's not your point, then I have no idea what you're trying to say.