From df4c39e219bc51e9daf616f838c81f965d618e13 Mon Sep 17 00:00:00 2001 From: Thomas Cioppettini <544875+tomciopp@users.noreply.github.com> Date: Sat, 15 Aug 2026 22:09:37 -0400 Subject: [PATCH] perf: Copy file mode with chmod instead of stat and write_stat --- lib/elixir/lib/file.ex | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/elixir/lib/file.ex b/lib/elixir/lib/file.ex index e865f956556..4246ea89c5c 100644 --- a/lib/elixir/lib/file.ex +++ b/lib/elixir/lib/file.ex @@ -1362,9 +1362,8 @@ defmodule File do end defp copy_file_mode(src, dest) do - with {:ok, dest_fileinfo} <- stat(dest), - {:ok, src_fileinfo} <- stat(src) do - write_stat(dest, %{dest_fileinfo | mode: src_fileinfo.mode}) + with {:ok, src_fileinfo} <- stat(src) do + chmod(dest, src_fileinfo.mode) end end