tomerfiliba / plumbum

Plumbum: Shell Combinators
https://plumbum.readthedocs.io
MIT License
2.81k stars 183 forks source link

Try to avoid creating temp dirs in the current working directory #571

Closed gschaffner closed 2 years ago

gschaffner commented 2 years ago

Try to use mktemp -d before falling back to calling mktemp with an explicit template (for compat. with some BSD variants of mktemp (see #176)).

Testing shows shows that this fixes temp dirs being created in the current working directory on systems using a recent current GNU coreutils mktemp variant and on systems using the mktemp variant packaged with some macOS versions (e.g. 10.15). This may also fix the issue on other systems as well (see https://stackoverflow.com/a/2792789).

(Oddly, this fixes the issue on macOS 10.15, but not on macOS 11.6, which does not have the issue in the first place despite mktemp having an identical man page on 10.15 and 11.6.)

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.02%) to 82.248% when pulling 36b05f98b306dd1baea318561ab94167878cfb16 on gschaffner:mktemp into a11ba7ff782314f97aa5205dad5309e178686cca on tomerfiliba:master.

henryiii commented 2 years ago

Thanks!