yggmail icon indicating copy to clipboard operation
yggmail copied to clipboard

Not working on Windows (MingW)

Open Revertron opened this issue 2 years ago • 10 comments

Describe the bug It starts without -password, and seems to work, but I can't send messages from Thunderbird, as yggmail doesn't want connections without password. If I try to run yggmail with -password, I get this:

[  Yggmail  ] Using database file "yggmail.db"
[  Yggmail  ] Generated new server identity
[  Yggmail  ] Mail address: 8fedf643a96bb837b36e796bf21924bd33cd27021b6092186ccecde320e8c9f9@yggmail
[  Yggmail  ] Please enter your new password:
panic: The handle is invalid.

goroutine 1 [running]:
main.main()
        C:/msys64/home/Revertron/go/pkg/mod/github.com/neilalexander/[email protected]/cmd/yggmail/main.go:91 +0x1255

To Reproduce Steps to reproduce the behavior:

  1. Make go install github.com/neilalexander/yggmail/cmd/yggmail@latest in MingW64.
  2. Run go/bin/yggmail.exe -peer <some peer> -password.
  3. See the error.

Expected behavior It should get password from stdin.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Win10, MingW64 (latest)
  • Version: 20210709230215

Revertron avatar Jul 10 '21 09:07 Revertron

Should hopefully be fixed in 63de5e81e477ba08734b7cf02b8b278e45f0c19c, can you please give the latest main commit a try?

neilalexander avatar Jul 10 '21 10:07 neilalexander

Am I doing something wrong?

$ go install github.com/neilalexander/yggmail/cmd/yggmail@63de5e81e477ba08734b7cf02b8b278e45f0c19c
go: downloading github.com/neilalexander/yggmail v0.0.0-20210710104255-63de5e81e477
# github.com/neilalexander/yggmail/cmd/yggmail
go\pkg\mod\github.com\neilalexander\[email protected]\cmd\yggmail\main.go:89:38: cannot use syscall.Stdin (type syscall.Handle) as type int in argument to term.ReadPassword
go\pkg\mod\github.com\neilalexander\[email protected]\cmd\yggmail\main.go:95:38: cannot use syscall.Stdin (type syscall.Handle) as type int in argument to term.ReadPassword

Revertron avatar Jul 10 '21 10:07 Revertron

Which version of Go are you using?

neilalexander avatar Jul 10 '21 10:07 neilalexander

Give 90b02ba0d63683db24ef7983732d82b7fa8fd374 a try — this might fix it.

neilalexander avatar Jul 10 '21 10:07 neilalexander

Which version of Go are you using?

go 1.16

Revertron avatar Jul 10 '21 11:07 Revertron

Give 90b02ba a try — this might fix it.

[  Yggmail  ] Using database file "yggmail.db"
[  Yggmail  ] Mail address: 8fedf643a96bb837b36e796bf21924bd33cd27021b6092186ccecde320e8c9f9@yggmail
[  Yggmail  ] Please enter your new password:
panic: The handle is invalid.

goroutine 1 [running]:
main.main()
        C:/msys64/home/Revertron/go/pkg/mod/github.com/neilalexander/[email protected]/cmd/yggmail/main.go:90 +0x1435

Revertron avatar Jul 10 '21 11:07 Revertron

Can you try this not under mingw?

neilalexander avatar Jul 10 '21 11:07 neilalexander

Can you try this not under mingw?

There is no gcc for Windows without MingW:

go: downloading github.com/neilalexander/yggmail v0.0.0-20210710105511-90b02ba0d636
# github.com/mattn/go-sqlite3
cgo: exec gcc: exec: "gcc": executable file not found in %PATH%

Revertron avatar Jul 10 '21 11:07 Revertron

I mean try running it under a regular Command Prompt or PowerShell after building the .exe. I’m wondering if there’s something special about the mingw terminal.

neilalexander avatar Jul 10 '21 11:07 neilalexander

Aha, that works. But escape symbols for coloring do not work. Isn't there a better logging library in Go to handle different terminals? image

Revertron avatar Jul 10 '21 11:07 Revertron