Skip to content

Commit

Permalink
Used more specific lock
Browse files Browse the repository at this point in the history
Rather than piggyback on the build lock when getting project mix
config, use a different lock type.
  • Loading branch information
scohen committed Sep 4, 2024
1 parent 1d9f81a commit 9521cf7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions apps/remote_control/lib/lexical/remote_control/mix.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule Lexical.RemoteControl.Mix do
alias Lexical.Project
alias Lexical.RemoteControl
alias Lexical.RemoteControl.Build

def in_project(fun) do
if RemoteControl.project_node?() do
Expand All @@ -11,13 +10,17 @@ defmodule Lexical.RemoteControl.Mix do
end
end

def with_lock(fun) do
RemoteControl.with_lock(__MODULE__, fun)
end

def in_project(%Project{} = project, fun) do
# Locking on the build make sure we don't get a conflict on the mix.exs being
# already defined

old_cwd = File.cwd!()

Build.with_lock(fn ->
with_lock(fn ->
try do
Mix.ProjectStack.post_config(prune_code_paths: false)

Expand Down

0 comments on commit 9521cf7

Please sign in to comment.