Implement capture_io for ex_unit