-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use mktemp to create temporary directory and files #85
base: master
Are you sure you want to change the base?
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