Skip to content

Commit e4acc08

Browse files
author
José Valim
committed
Improve archive error on Windows
Signed-off-by: José Valim <[email protected]>
1 parent 2ab5d25 commit e4acc08

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/mix/lib/mix/tasks/archive.install.ex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ defmodule Mix.Tasks.Archive.Install do
5555
remove_previous_versions(previous)
5656

5757
archive = Path.join(Mix.Local.archives_path(), basename(src))
58-
check_file_exists(archive)
58+
check_file_exists(src, archive)
5959

6060
if Mix.Utils.copy_path!(src, archive, opts) do
6161
Mix.shell.info [:green, "* creating ", :reset, Path.relative_to_cwd(archive)]
@@ -83,15 +83,18 @@ defmodule Mix.Tasks.Archive.Install do
8383
"Are you sure you want to replace them?")
8484
end
8585

86-
defp check_file_exists(path) do
86+
defp check_file_exists(src, path) do
8787
# OTP keeps loaded archives open, this leads to unfortunate behaviour on
8888
# Windows when trying overwrite loaded archives. remove_previous_versions
8989
# completes successfully even though the file will be first removed after
9090
# the BEAM process is dead. Because of this we ask the user rerun the
9191
# command, which should complete successfully at that time
9292

9393
if File.exists?(path) and match?({:win32, _}, :os.type) do
94-
Mix.raise "Unable to overwrite open archives on Windows. Run the command again"
94+
Mix.raise "Unable to overwrite open archives on Windows. Please manually remove " <>
95+
"the existing archive at #{inspect path} and run this command again. In " <>
96+
"case re-running the command still does not work, please fetch the archive " <>
97+
"at #{inspect src} and manually copy it to #{inspect path}."
9598
end
9699
end
97100

0 commit comments

Comments
 (0)