air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
18.29k stars 815 forks source link

Win 10 Reload fails unable to delete main.exe #640

Open coraxwolf opened 2 months ago

coraxwolf commented 2 months ago

I am running on Windows 10 using git bash (have tried in power shell as well). When I make a change air attempts to reload and fails to end the current running task which causes an Access Denied error when build tries to replace the current main.exe. This results in an endless looping of trying to kill the process and starting the app causing address already in use errors which repeat endlessly until I cancel out of Air.

Here is an excerpt of the air debug logs:

[15:27:46] running...
[15:27:46] running process pid 29488
{"time":"2024-09-04T15:27:46.9243759-05:00","level":"INFO","source":{"function":"coraxwolf/contacts-go/cmd/server.(*Server).Start","file":"C:/Users/j*****/Documents/Projects/golang/Contacts/cmd/server/main.go","line":28},"msg":"Server is starting on :3000"}
[15:28:00] event: WRITE         "C:\\Users\\*****\\Documents\\Projects\\golang\\Contacts\\main.go"
[15:28:00] main.go has changed
[15:28:00] event: WRITE         "C:\\Users\\******\\Documents\\Projects\\golang\\Contacts\\main.go"
[15:28:00] main.go has changed
[15:28:01] flushing events
[15:28:01] main.go has changed
[15:28:01] building...
[15:28:01] trying to kill pid 29488, cmd [cmd /c C:\Users\*****\Documents\Projects\golang\Contacts\tmp\main.exe]
[15:28:01] failed to kill PID 29488, error: exit status 1
[15:28:01] failed to remove C:\Users\*******\Documents\Projects\golang\Contacts\tmp\main.exe, error: remove C:\Users\*********\Documents\Projects\golang\Contacts\tmp\main.exe: Access is denied.

I am sure this is something in my settings and/or how I am trying to use this tool.