add dontCaptureExit option to allow not capturing the exit event