Skip to content
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

Merged
merged 3 commits into from
Oct 28, 2019

Conversation

rodjek
Copy link
Contributor

@rodjek rodjek commented Oct 25, 2019

No description provided.

@rodjek rodjek requested a review from a team as a code owner October 25, 2019 04:46
@rodjek rodjek force-pushed the pdk-1443 branch 2 times, most recently from 7ee4849 to 7405f22 Compare October 25, 2019 04:57
@coveralls
Copy link

coveralls commented Oct 25, 2019

Coverage Status

Coverage decreased (-0.06%) to 91.784% when pulling 8135e91 on rodjek:pdk-1443 into 085c98f on puppetlabs:master.

@@ -10,6 +10,8 @@ class Command
attr_accessor :environment
attr_writer :exec_group

TEMPFILE_MODE = File::RDWR | File::BINARY | File::CREAT | File::TRUNC
Copy link
Contributor

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 }
Copy link
Contributor

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.

Copy link
Contributor

@glennsarti glennsarti left a 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.

@rodjek rodjek merged commit 9205b4a into puppetlabs:master Oct 28, 2019
@rodjek rodjek deleted the pdk-1443 branch October 28, 2019 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants