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

Terminal text gets garbled on Windows #2

Closed
SonarBeserk opened this issue Oct 22, 2017 · 16 comments
Closed

Terminal text gets garbled on Windows #2

SonarBeserk opened this issue Oct 22, 2017 · 16 comments

Comments

@SonarBeserk
Copy link

Whenever running air on windows the text has issues printing.

λ c:\Users\sonar\.air .

             _
     /\     (_)
    /  \     _   _ __
   / /\ \   | | | '__|
  / ____ \  | | | |
 /_/    \_\ |_| |_|

Live reload for Go apps :)

[19:38:14.574] watching .
[19:38:14.577] watching protos
[19:38:14.579] !exclude tmp
[19:38:14.580] building...
[19:3[81:91:53.83:2155]. 3!2e6x]c l!uedxec ltumdpe
 tmp[
19:38:15.329] !exclude tmp
[19:38:15.341] running...

I get this issue running in git bash as well as cmd.

@cosmtrek
Copy link
Collaborator

Thanks for your report. I'll take time to figure it out. Could you tell me what's your project structure and your Windows version?

@SonarBeserk
Copy link
Author

I have a single main.go file in the directory that runs an http server. I am running Windows 10 Pro Build 14393

@cosmtrek
Copy link
Collaborator

@mattn Could you help me look at this issue when you have free time? Actually I have no idea how to solve it because I'm not familiar with Windows terminal, thanks a lot!

@SonarBeserk I'm very sorry for this, it may take long time to fix it. Could you try to fix it if you are able to?

@mattn
Copy link
Contributor

mattn commented Oct 23, 2017

Hi, I'll look into it in later.

@mattn
Copy link
Contributor

mattn commented Oct 23, 2017

garbage is mixed log-output.

[19:3[81:91:53.83:2155]. 3!2e6x]c l!uedxec ltumdpe

You must use sync.Mutex to avoid mixed output.

@cosmtrek
Copy link
Collaborator

@mattn Did you mean this? bf222c2

@mattn
Copy link
Contributor

mattn commented Oct 23, 2017

Yes, it fixed this issue on my environment.

@mattn
Copy link
Contributor

mattn commented Oct 23, 2017

I found another issue.

61c9bcb31506e7e3

I think os.Remove should be called before go build.

@cosmtrek
Copy link
Collaborator

@mattn os.Remove just delete the old binary file, actually it's OK to remain this file because the new binary file will overwrite this old one. Could you provide the error?

@mattn
Copy link
Contributor

mattn commented Oct 23, 2017

Yes, sequence should be

  1. kill process
  2. remove tmp/main.exe
  3. go build (generate tmp/main.exe)

but as far as I see the output, seems to be:

  1. kill process
  2. go build (generate tmp/main.exe)
  3. remove tmp/main.exe

@mattn
Copy link
Contributor

mattn commented Oct 23, 2017

Windows can't overwrite file while another process(or it-self) open the file.

@cosmtrek
Copy link
Collaborator

@mattn Got it, I'll fix this.

@cosmtrek
Copy link
Collaborator

cosmtrek commented Oct 24, 2017

@mattn I've fixed it, and found another interesting issue about the colorful output.

See the picture follows:

screen shot 2017-10-24 at 13 42 30

Text in magenta color is invisible in PowerShell... Maybe blame it :)

@cosmtrek
Copy link
Collaborator

@SonarBeserk I've fixed some problems on Windows, could you try a new binary?

curl -fLo ~/.air.exe \
    https://raw.githubusercontent.com/cosmtrek/air/master/bin/windows/air.exe

@cosmtrek
Copy link
Collaborator

Oops, this issue is closed automatically since current branch fix-2 was merged by master...

@cosmtrek cosmtrek reopened this Oct 24, 2017
@SonarBeserk
Copy link
Author

Looks fine, I don't use powershell for go development so that's not something of personal concern. It might be better to open a separate ticket to fix that issue.

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

No branches or pull requests

3 participants