Malcolm Nooning schrieb:
I should add that the lines below are already in the code so normally
there would be a cleanup.
# Clean up after us.
END {
chdir(File::Spec->tmpdir);
File::Path::rmtree([$startdir]);
}
Right. It usually works, too. Except when the tests are somehow killed
by the user and normal clean-up doesn't happen. Switching to using
File::Temp's cleanup routines won't fix this, of course. Two ways out:
- Use File::Temp to create a temporary directory with an unknown part,
i.e. using a template "pp_switch_tests_XXXXX" with XXXXX replaced by a
random string for each run.
- Use the "pp_switch_tests" subdirectory of the extracted distribution's
base directory. If the user does an rm -rf PAR-Packer-0.9XX, that'll be
cleaned up for him. If he can't because parts are owned by root, he'll
figure that out alright. He won't necessarily figure out why, after he
extracted a fresh copy, the tests fail with a permission error. (Because
the pp_switch_tests dir in /tmp is owned by root.)
Steffen