Skip to content

Commit e407412

Browse files
spewk8s-ci-robot
authored andcommitted
Move from (f *File).WriteString(...) to ioutil.WriteFile(...) to Fix a bug where WriteString fails because the file is closed before writing. (#393)
In a previous commit we started closing the file in createTempFile after having it returned to ensure that the os.Remove(...) would not result in error due to an open file handle. This caused WriteString to start failing.
1 parent 4d80565 commit e407412

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clusterctl/clusterdeployer/clusterclient.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ func createTempFile(contents string) (string, error) {
260260
if err = f.Close(); err != nil {
261261
return "", err
262262
}
263-
_, err = f.WriteString(contents)
263+
err = ioutil.WriteFile(f.Name(), []byte(contents), 0644)
264264
if err != nil {
265265
return "", err
266266
}

0 commit comments

Comments
 (0)