Skip to content

Commit f2e61f6

Browse files
committed
Use system tmp dir for socket copy test, closes #15093
1 parent 5abcc33 commit f2e61f6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/elixir/test/elixir/file_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,13 +818,14 @@ defmodule FileTest do
818818

819819
@tag :unix
820820
test "cp_r skips sockets and other special files" do
821-
src = tmp_path("src_with_socket")
821+
# We use tmpdir because macOS has a limit on socket paths
822+
src = Path.join(System.tmp_dir(), "src_with_socket")
822823
dest = tmp_path("dest_with_socket")
823824
socket_path = Path.join(src, "test.sock")
824-
regular_file = Path.join(src, "regular.txt")
825+
regular_path = Path.join(src, "regular.txt")
825826

826827
File.mkdir_p!(src)
827-
File.write!(regular_file, "content")
828+
File.write!(regular_path, "content")
828829

829830
{:ok, socket} = :gen_tcp.listen(0, [:local, {:ifaddr, {:local, socket_path}}])
830831

@@ -833,7 +834,6 @@ defmodule FileTest do
833834
assert :elixir_utils.read_link_type(socket_path) == {:ok, :other}
834835

835836
{:ok, copied_files} = File.cp_r(src, dest)
836-
837837
assert Path.join(dest, "regular.txt") in copied_files
838838

839839
refute File.exists?(Path.join(dest, "test.sock"))

0 commit comments

Comments
 (0)