Closed OvermindDL1 closed 8 years ago
This is a hex issue so please reopen at https://github.com/hexpm/hex. Unfortunately I don't know what the "file already exists" error means when removing a directory.
On Windows it most likely means there is something using the current directory. Or a terminal session, a dangling file cursor, etc. maybe use file.rm_rf and print a warning if it cannot be removed due to this particular reason.
On Wednesday, August 24, 2016, Eric Meadows-Jönsson < notifications@github.com> wrote:
This is a hex issue so please reopen at https://github.com/hexpm/hex. Unfortunately I don't know what the "file already exists" error means when removing a directory.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/elixir-lang/elixir/issues/5155#issuecomment-242094859, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAlbjMCOxZALXSEE-UU5TX6Uwh57AnZks5qjFwpgaJpZM4JsE6O .
José Valim www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D
This is a hex issue so please reopen at https://github.com/hexpm/hex. Unfortunately I don't know what the "file already exists" error means when removing a directory.
Ah thanks, I was searching for a hex github repo but somehow never found that, so I ended up here.
On Windows it most likely means there is something using the current directory. Or a terminal session, a dangling file cursor, etc. maybe use file.rm_rf and print a warning if it cannot be removed due to this particular reason.
I thought the same, but I could delete it manually with no problem... Would be nicer to print a reason, perhaps say it is unable to automatically remove it and to remove it manually then re-run? Would be nice to print that for each directory too instead of running, deleting, running, deleting next, etc... It happens on every one that has to update every time I update (also happens with the phoenix reloader sometimes as well, it cannot File.rm_rf
the _build/dev/lib/my_server/priv/
with the error of:
** (File.Error) could not remove files and directories recursively from "c:/Users/<myuser>/Projects/my_server/_build/dev/lib/my_server/priv": file already exists
(elixir) lib/file.ex:919: File.rm_rf!/1
(mix) lib/mix/utils.ex:317: Mix.Utils.symlink_or_copy/2
(mix) lib/mix/project.ex:414: Mix.Project.build_structure/2
(phoenix) lib/phoenix/code_reloader/server.ex:111: Phoenix.CodeReloader.Server.mix_compile/1
(phoenix) lib/phoenix/code_reloader/server.ex:83: Phoenix.CodeReloader.Server.mix_compile/3
(phoenix) lib/phoenix/code_reloader/server.ex:40: anonymous fn/2 in Phoenix.CodeReloader.Server.handle_call/3
(phoenix) lib/phoenix/code_reloader/server.ex:132: Phoenix.CodeReloader.Server.proxy_io/1
(phoenix) lib/phoenix/code_reloader/server.ex:38: Phoenix.CodeReloader.Server.handle_call/3
(stdlib) gen_server.erl:615: :gen_server.try_handle_call/4
(stdlib) gen_server.erl:647: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
So I have my server start set to rm -r _build/dev/lib/my_server/priv/; iex --name devserver -S mix phoenix.server
and I have to ctrl+c it every once in a while when that error pops up and hit up then enter again to clear and relaunch it.
I am starting to wonder if it is a bug in File.rm_rf!
or something on windows since I can always manually delete it but it cannot...
@OvermindDL1 I don't know what the underlying issue but I would suggest looking into if any handles are open to the directories or files inside the directory. This tool can help with that https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx. It could be that rm
in the terminal does some harder force delete.
I would also appreciate any help with improving the error messages.
I thought the same, but I could delete it manually with no problem...
Maybe it was the Elixir process itself holding a handle to the file or it was used to hold a handle to the file but the OS did not fully claim it back at the time. We had all kinds of hard to explain issues when we implemented archives on Windows.
@OvermindDL1 closing this for now anyway. Please open up an issue on hex? :heart:
Maybe it was the Elixir process itself holding a handle to the file or it was used to hold a handle to the file but the OS did not fully claim it back at the time. We had all kinds of hard to explain issues when we implemented archives on Windows.
That was my thought. I had indeed looked via Process Explorer many times to find what was holding c:/Users/<myuser>/Projects/my_server/_build/dev/lib/my_server/priv
but it never found any results. I do not care too much about the hex one (though I will make a bug report there, thanks for the link again!) but the phoenix reloader one really really bugs, should I post that in the phoenix repo or is it more likely something in elixir or mix straight?
The Phoenix one is likely a bug in Mix, maybe we could try something different but I have no clue about what.
Precheck
Doing a full update of packages of one of my apps, thus running
mix deps.update --all
.Environment
Current behavior
Running
mix deps.update --all
produces:The server is not running, no open windows to that location or anywhere near. This happens every time the command is run.
Expected behavior
Deps would update.
Extra notes
Running
rm -r deps/phoenix
and thenmix deps.update --all
worked, thus showing the directory was not locked.