summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2017-05-16 13:48:49 +0100
committerGitHub <noreply@github.com>2017-05-16 13:48:49 +0100
commite6827f7cc394b2e17df40c537fcdad07e1dfa172 (patch)
tree5cde5b2fef8c6b4b8b6f529a128fca7d865cab6c /lib
parent797301ace8f0ce7e3e43eac9d5fbb11c0f6f615a (diff)
parent117c983d13d4e6ff76c09d988cd5114294852ff0 (diff)
downloadNim-e6827f7cc394b2e17df40c537fcdad07e1dfa172.tar.gz
Merge pull request #5819 from cdunn2001/fix-5816
Use writeable file in parsecfg.writeConfig()
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/parsecfg.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/parsecfg.nim b/lib/pure/parsecfg.nim
index 28681a11f..307808556 100644
--- a/lib/pure/parsecfg.nim
+++ b/lib/pure/parsecfg.nim
@@ -540,7 +540,8 @@ proc writeConfig*(dict: Config, filename: string) =
   ## Writes the contents of the table to the specified configuration file.
   ## Note: Comment statement will be ignored.
   let file = open(filename, fmWrite)
-  let fileStream = newFileStream(filename)
+  defer: file.close()
+  let fileStream = newFileStream(file)
   defer: fileStream.close()
   dict.writeConfig(fileStream)