Skip to content

Platform independent mktemp#27643

Closed
albertzaharovits wants to merge 1 commit intoelastic:masterfrom
albertzaharovits:master
Closed

Platform independent mktemp#27643
albertzaharovits wants to merge 1 commit intoelastic:masterfrom
albertzaharovits:master

Conversation

@albertzaharovits
Copy link
Copy Markdown
Contributor

Generate platform independent temp directory using an explicit template instead of branching on the platform. (branching can fail if you use coreutils on Darwin)
on macOS:

   -t prefix
       Generate a template (using the supplied prefix and TMPDIR if set) to create a filename tem-plate. 

on linux (coreutils):

  -t                  interpret TEMPLATE as a single file name component,
                        relative to a directory: $TMPDIR, if set; else the
                        directory specified via -p; else /tmp [deprecated]

All hail StackOverflow

@jasontedor
Copy link
Copy Markdown
Member

Thanks @albertzaharovits, but I would prefer to not have to reason about a one-liner that could be invoking a different command depending on the OS. I do not want to have to reason about well it could be this one, or it could be that one, and I also do not want to have to maintain something like this. I think a clearer solution is to detect when we are relying on BSD mktemp versus the GNU mktemp. I opened #27659.

@jasontedor jasontedor closed this Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants