Common-ized debug console-wait-on-exit, cleaned up