Open minolmal opened 3 weeks ago
Having the same issue.
I've tested the commands in toml. they work fine as well.
I'm new to Go. but I think issue should be somewhere around final paths parsed to "runner".
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 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.
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!
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
@minolmal, could you close the issue?
@minolmal, could you close the issue?
no this was a temp solution, this needs to be fixed
@minolmal, could you close the issue?
no this was a temp solution, this needs to be fixed
yeah, you're right.
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
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))
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
I'll revert the commit and release a new version. Then fix and fully test the broken pr.
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?
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.
This is the default config I get from air init.
as you can see here, binary works fine when I run it manually.
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)
(I'm running PowerShell 7.4.5 and Windows 11 Home 22H2 22621.4317)