-
Notifications
You must be signed in to change notification settings - Fork 225
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
Add file::with_tmpfile()
function
#3288
base: main
Are you sure you want to change the base?
Conversation
!feature * **Add `file::with_tmpfile()` function** Create a temporary file and execute the block with the filename created as an argument. The file is deleted after the block execution. This will only operate on the machine you run Bolt on.
|
Interesting. We have something similar in BoltSpec bolt/spec/lib/bolt_spec/files.rb Line 7 in 4b30c39
|
Consider the case:
There are 2 things:
If we can deal with both cases I'm fine to reuse the BoltSpec code :-D Actually I'm totally ok to not include this function into the Boltlib ( |
I dont understand the example? What do you need with an empty file in run_command? I guess, for me the only use case I can think of for a "with temp file" you would know the content of the file (or be generating it) explicitly for consumption by something else. Therefore, why would we need a temp file to exist with no way to modify the content? As far as the return type etc, yeah that would be changed, i was more getting at the use case here and pointing out that we probably would want to have the argument to write content. |
I mean that the file content may be generated by a command, taking the file name as an argument. In this case the file content is not known in advance. Though, to be honest, for now it's purely "synthetic" case. I'm not sure how many ppl might have this requirement. |
!feature
file::with_tmpfile()
function Create a temporary file and execute the block with the filename created as an argument. The file is deleted after the block execution. This will only operate on the machine you run Bolt on.