Skip to content

Commit 04dee9d

Browse files
committed
Use more compact block syntax for tempfile
1 parent 3a24f13 commit 04dee9d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/arduino_ci/cpp_library.rb

+1-4
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,10 @@ def in_exclude_dir?(sourcefile_path)
255255
# @param gcc_binary [String]
256256
def libasan?(gcc_binary)
257257
unless @has_libasan_cache.key?(gcc_binary)
258-
file = Tempfile.new(["arduino_ci_libasan_check", ".cpp"])
259-
begin
258+
Tempfile.create(["arduino_ci_libasan_check", ".cpp"]) do |file|
260259
file.write "int main(){}"
261260
file.close
262261
@has_libasan_cache[gcc_binary] = run_gcc(gcc_binary, "-o", "/dev/null", "-fsanitize=address", file.path)
263-
ensure
264-
file.delete
265262
end
266263
end
267264
@has_libasan_cache[gcc_binary]

0 commit comments

Comments
 (0)