Deduplicate code, improve error handling.
slurp
Also fixes problem with missing diff when running `copy`.