Commit 7296cce
committed
Check for nil before closing Uniquefile
On Windows, we by default assign stdout for the child process to a file:
stdout = Puppet::FileSystem::Uniquefile.new('puppet')
However, if TMPDIR, TEMP or TMP env vars refer to a non-existent directory, then
`Uniquefile.new` will raise, leaving `stdout` set to nil, so the later call to
`stdout.close` raised NoMethodError.
So check for nil before closing. We don't have this issue on posix, because
it uses an IO pipe instead of Uniquefile.
Fixes #93851 parent a423af8 commit 7296cce
File tree
2 files changed
+10
-1
lines changed- lib/puppet/util
- spec/unit/util
2 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
834 | 834 | | |
835 | 835 | | |
836 | 836 | | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
837 | 846 | | |
838 | 847 | | |
839 | 848 | | |
| |||
0 commit comments