-
Notifications
You must be signed in to change notification settings - Fork 104
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
(PDK-1443) Windows safe Tempfiles & environment variable access #790
Conversation
7ee4849
to
7405f22
Compare
@@ -10,6 +10,8 @@ class Command | |||
attr_accessor :environment | |||
attr_writer :exec_group | |||
|
|||
TEMPFILE_MODE = File::RDWR | File::BINARY | File::CREAT | File::TRUNC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 for binary mode!
@@ -19,8 +21,8 @@ def initialize(*argv) | |||
@process = ChildProcess.build(*@argv) | |||
@process.leader = true | |||
|
|||
@stdout = Tempfile.new('stdout').tap { |io| io.sync = true } | |||
@stderr = Tempfile.new('stderr').tap { |io| io.sync = true } | |||
@stdout = Tempfile.new('stdout', mode: TEMPFILE_MODE).tap { |io| io.sync = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed this is the only place Tempfile is used in the PDK source. There are many uses in spec tests but that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference - the ENV code comes from Puppet and has a whole suite of tests against it. While normally we should probably test all of the FFI wrappers, I'm happy to not do so due to it being tested thoroughly in Puppet and our acceptance tests will stress that it behaves as we expect.
No description provided.