diff options
author | Mark Longair <mhl@pobox.com> | 2013-10-29 17:43:59 +0000 |
---|---|---|
committer | Mark Longair <mhl@pobox.com> | 2013-10-29 17:43:59 +0000 |
commit | 37c91fceb8a2624e8bfb7a5dd644a36c81938b97 (patch) | |
tree | 5d465b8d3f97d9fce331b1692747bf8495f8aef6 /lib/tasks | |
parent | 4c695f76fa62aeca14694f0af75e86f465f7efac (diff) |
Make sure that the temporary file is closed before reading from it
Thanks to Louise Crow for pointing out this problem.
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/import.rake | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index f6a1f3e38..015331a3a 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -15,8 +15,11 @@ namespace :import do STDERR.puts "Only a dry run; public bodies will not be created" end - tmp_csv = Tempfile.new 'alaveteli' - tmp_csv.write STDIN.read + tmp_csv = nil + Tempfile.open('alaveteli') do |f| + f.write STDIN.read + tmp_csv = f + end number_of_rows = 0 |