Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/mix/lib/mix/sync/lock.ex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ defmodule Mix.Sync.Lock do
opts = Keyword.validate!(opts, [:on_taken])

hash = key |> :erlang.md5() |> Base.url_encode64(padding: false)
path = Path.join([System.tmp_dir!(), "mix_lock", hash])
path = Path.join(base_path(), hash)

pdict_key = {__MODULE__, path}
has_lock? = Process.get(pdict_key, false)
Expand All @@ -119,6 +119,13 @@ defmodule Mix.Sync.Lock do
end
end

defp base_path do
user = System.get_env("USER", "default")
path = Path.join([System.tmp_dir!(), "mix_lock_#{Base.url_encode64(user, padding: false)}"])
File.mkdir_p!(path)
path
end

defp lock_disabled?(), do: System.get_env("MIX_OS_CONCURRENCY_LOCK") in ~w(0 false)

defp lock(path, on_taken) do
Expand Down
9 changes: 8 additions & 1 deletion lib/mix/lib/mix/sync/pubsub.ex
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,16 @@ defmodule Mix.Sync.PubSub do

defp hash(key), do: :erlang.md5(key)

defp base_path do
user = System.get_env("USER", "default")
path = Path.join([System.tmp_dir!(), "mix_pubsub_#{Base.url_encode64(user, padding: false)}"])
File.mkdir_p!(path)
path
end

defp path(hash) do
hash = Base.url_encode64(hash, padding: false)
Path.join([System.tmp_dir!(), "mix_pubsub", hash])
Path.join(base_path(), hash)
end

defp recv(socket, size, timeout \\ :infinity) do
Expand Down
Loading