Skip to content

Commit 765307b

Browse files
committed
Do not crash installer on 1.13
Fixes #1141
1 parent f0e2818 commit 765307b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

scripts/installer.exs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,21 @@ defmodule ElixirLS.Mix do
352352
new_md5 = external_lockfile |> File.read!() |> :erlang.md5()
353353

354354
if old_md5 != new_md5 do
355-
lockfile = Path.join(install_dir, "mix.lock")
356-
old_lock = Mix.Dep.Lock.read(lockfile)
357-
new_lock = Mix.Dep.Lock.read(external_lockfile)
358-
Mix.Dep.Lock.write(Map.merge(old_lock, new_lock), file: lockfile)
359-
File.write!(md5_path, Base.encode64(new_md5))
360-
Mix.Task.rerun("deps.get")
355+
if Version.match?(System.version(), ">= 1.14.0-dev") do
356+
lockfile = Path.join(install_dir, "mix.lock")
357+
old_lock = Mix.Dep.Lock.read(lockfile)
358+
new_lock = Mix.Dep.Lock.read(external_lockfile)
359+
Mix.Dep.Lock.write(Map.merge(old_lock, new_lock), file: lockfile)
360+
File.write!(md5_path, Base.encode64(new_md5))
361+
Mix.Task.rerun("deps.get")
362+
else
363+
IO.puts(
364+
:stderr,
365+
"Lockfile conflict. Please clean up your mix install directory #{install_dir}"
366+
)
367+
368+
System.halt(1)
369+
end
361370
end
362371

363372
first_build? ->

0 commit comments

Comments
 (0)