Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Air not running properly on windows 11 64bit #659

Open
minolmal opened this issue Oct 10, 2024 · 14 comments
Open

Air not running properly on windows 11 64bit #659

minolmal opened this issue Oct 10, 2024 · 14 comments

Comments

@minolmal
Copy link

I have tried several suggestions in issues, (both open and closed) still couldn't get Air to properly run the binary. I've run with -d in case it helps.
Screenshot 2024-10-10 060728

This is the default config I get from air init.
Screenshot 2024-10-10 060748

as you can see here, binary works fine when I run it manually.
Screenshot 2024-10-10 062026

I'm not quite sure if it's powershell or Win11, but you can use normal "/" in commands and it works fine. (even in cmd)
Screenshot 2024-10-10 062151

(I'm running PowerShell 7.4.5 and Windows 11 Home 22H2 22621.4317)

@minolmal minolmal changed the title Air not running correctlt on windows 11 64bit Air not running properly on windows 11 64bit Oct 10, 2024
@LuanZwang
Copy link

Having the same issue.

image

@minolmal
Copy link
Author

I've tested the commands in toml. they work fine as well.
Screenshot 2024-10-10 063858

I'm new to Go. but I think issue should be somewhere around final paths parsed to "runner".

@omarattia3143
Copy link

omarattia3143 commented Oct 10, 2024

I have the same issue which is has weird path to bin file -> '\"main.exe\"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

@minolmal
Copy link
Author

I have the same issue which is has weird path to bin file -> '"main.exe"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

I set full_bin = "<absolute_path>\\tmp\\main.exe" and it worked flawlessly.

@LuanZwang
Copy link

I have the same issue which is has weird path to bin file -> '"main.exe"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

Worked perfectly after it. Thank you!

@f-llewellyn
Copy link

f-llewellyn commented Oct 11, 2024

I have the same issue which is has weird path to bin file -> '"main.exe"' this looks like a bug, but you can avoid this till there is a fix by specifying an absolute path in the toml file -> [build] -> full_bin =""

I set full_bin = "<absolute_path>\\tmp\\main.exe" and it worked flawlessly.

This resolved my issue as well

@LuanZwang
Copy link

@minolmal, could you close the issue?

@omarattia3143
Copy link

@minolmal, could you close the issue?

no this was a temp solution, this needs to be fixed

@LuanZwang
Copy link

@minolmal, could you close the issue?

no this was a temp solution, this needs to be fixed

yeah, you're right.

@omarattia3143
Copy link

omarattia3143 commented Oct 11, 2024

I found the issue in this line of code in runner/config.go:
c.Build.Bin = fmt.Sprintf("%q", c.Build.Bin)
https://github.com/air-verse/air/blame/df13da5c21362c64f16d455feb28d189d9c9f8fd/runner/config.go#L333
related to #646
when the line removed it is working as expected

@JasonGoemaat
Copy link

Just a comment here as I'm experiencing this on windows 10 also. Not sure what whitespace has to do with this issue but it's mentioned in a pull request dealing with whitespace. The problem seems to be that the full path to the exe is being encoded and escaped as a json string would be. It seems to be returning the same error that would be returned by a command prompt like this:

C:\Users\jason>c:\hello.exe
'c:\hello.exe' is not recognized as an internal or external command,
operable program or batch file.

But the air command includes surrounding double quotes escaped with backslashes and backslashes escaping the other backslashes exactly like this:

C:\Users\jason>\"c:\\hello.exe\"
'\"c:\\hello.exe\"' is not recognized as an internal or external command,
operable program or batch file.

Ah, I see now. That merged PR is mentioned because it is the one that introduced the bug, probably by these lines:

return fmt.Sprintf("%q", filepath.Join(c.Root, bin))

@moboqe
Copy link

moboqe commented Oct 15, 2024

I found the issue in this line of code in runner/config.go: c.Build.Bin = fmt.Sprintf("%q", c.Build.Bin) https://github.com/air-verse/air/blame/df13da5c21362c64f16d455feb28d189d9c9f8fd/runner/config.go#L333 related to #646 when the line removed it is working as expected

Yeah, that is the source of the issue in my win10 as well

before
after

@cosmtrek
Copy link
Collaborator

I'll revert the commit and release a new version. Then fix and fully test the broken pr.

@minolmal
Copy link
Author

Air v1.61.1 with default config seems to be working fine.

@cosmtrek Thank you for the quick response. I think this commit should correct several issues in the issues log. should I close this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@JasonGoemaat @cosmtrek @omarattia3143 @minolmal @f-llewellyn @moboqe @LuanZwang and others