Refactor exec-with-out.