Messages such as "Blender quit" get in the way of custom commands, add G.quiet to suppress noisy "info" prints.
fcacebbfb1