Use mktemp to create temporary directory and files#85
Use mktemp to create temporary directory and files#85lucaskanashiro wants to merge 1 commit intocknadler:masterfrom
Conversation
|
Hey Lucas, Thanks for the PR. Do you know the compatibility of mktemp? Is it available by default on all modern versions of OSX and Linux? |
|
Hi, I do not have an OSX system to test it, but after read this answer [1] I suppose that mktemp call passing the template should work. [1] https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x |
|
Someone with an OSX system could test this patch? Just to confirm my thoughts :) |
|
|
|
FYI what about creating directly the file with: TMPFILE="$(mktemp /tmp/vim-anywhere.XXXXX)"
function remove_tmp_file() {
rm -rf $TMPFILE
}
## Removes all temp files on exit and sigint
trap "remove_tmp_file" EXIT SIGINT
|
|
Thanks for the report @d1egoaz . I've tried to keep the same code structure and create temporary directory and file in a secure way. However, since the '-p' option is not available in OSX systems we can follow your approach and create the temp file directly. I'll update this PR. |
|
Hope I'm not adding fuel to a fire here but this PR can be replaced by setting Also the Maybe we also want to clean up the permissions on the old files by doing |
Closes #81