Skip to content

Conversation

@eissar
Copy link
Contributor

@eissar eissar commented Apr 3, 2025

replace all occurrences of os.Stdin.Fd() with os.Stdout.Fd()

@eissar
Copy link
Contributor Author

eissar commented Apr 3, 2025

I tried using the binaries in V2.0.0 and still was getting the same error as reported by @nimrossum in #9 . It looks like there was some misunderstanding as the program was building fine, but would not run.

The problem is this line:

_, height, err := term.GetSize(int(os.Stdin.Fd()))

Not exactly sure why stdin doesn't work, I think it's something to do with the handle for stdin not being a file descriptor on windows or something? anyways there's an issue talking about it here:
golang/go#20388 (comment)

I was able to get the program to run by changing those occurrences of os.Stdin.Fd() to os.Stdout.Fd() on my windows machine.

@eissar eissar marked this pull request as ready for review April 3, 2025 02:19
@ZielMartin
Copy link

ZielMartin commented Apr 9, 2025

second this!

I had issues getting the application to run on windows inside of MINGW64 (git bash terminal)
I got the following error:

panic: The handle is invalid.

goroutine 1 [running]:
github.com/bttger/markdown-flashcards/internal.check(...)
        C:/Users/ZielM/projects/markdown-flashcards/internal/utils.go:35
github.com/bttger/markdown-flashcards/internal.ScrollDownScreen()
        C:/Users/ZielM/projects/markdown-flashcards/internal/utils.go:27 +0x86
github.com/bttger/markdown-flashcards/internal.(*Session).Start(0xc0000dfe28)
        C:/Users/ZielM/projects/markdown-flashcards/internal/leitner.go:71 +0x14b
main.main()
        C:/Users/ZielM/projects/markdown-flashcards/cmd/mdfc.go:146 +0x9b2

after trying out the suggested solution it worked like a charm!

sadly I'm not too familiar with go, so can't say anything about the correctness of the fix but the result looks fine.

Have a nice day :)

@bttger bttger self-requested a review June 12, 2025 13:14
@bttger
Copy link
Owner

bttger commented Jun 12, 2025

Thank you for the PR! I was not able to test it under Windows, so thank you. Just checked out your branch and adapted my test file a bit and seems to still work fine on Linux. Will merge and release a patch version.

@bttger bttger merged commit a18ec05 into bttger:main Jun 12, 2025
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

Successfully merging this pull request may close these issues.

3 participants