Add `scoped_trap` and use it to allow `attach` to block on pending jobs.
Improve output in a number of small ways.