found a bug in run_and_capture, changed to block form which seemed to fix it.  The symptoms were a process which was in sleep mode and hadn't yet returned, so an if statement made later would just freeze and not go anywhere