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

Fix password prompt on Windows #24

Merged
merged 2 commits into from
Oct 16, 2021
Merged

Conversation

pmatseykanets
Copy link
Owner

@pmatseykanets pmatseykanets commented Oct 16, 2021

GOOS=windows go build ./cmd/gh-find
# github.com/pmatseykanets/gh-tools/terminal
terminal/terminal.go:17:33: cannot use syscall.Stdin (type syscall.Handle) as type int in argument to terminal.GetState
terminal/terminal.go:30:24: cannot use syscall.Stdin (type syscall.Handle) as type int in argument to terminal.Restore
terminal/terminal.go:44:40: cannot use syscall.Stdin (type syscall.Handle) as type int in argument to terminal.ReadPassword

The syscall.Stdin has to be converted to int.

https://pkg.go.dev/syscall?GOOS=windows#pkg-variables

var (
	Stdin  = getStdHandle(STD_INPUT_HANDLE)
	Stdout = getStdHandle(STD_OUTPUT_HANDLE)
	Stderr = getStdHandle(STD_ERROR_HANDLE)
)

func getStdHandle(h int) (fd Handle) {...}

vs

https://pkg.go.dev/syscall?GOOS=linux#pkg-variables

var (
	Stdin  = 0
	Stdout = 1
	Stderr = 2
)

@pmatseykanets pmatseykanets self-assigned this Oct 16, 2021
@codecov
Copy link

codecov bot commented Oct 16, 2021

Codecov Report

Merging #24 (a3f6661) into master (8552a8f) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #24   +/-   ##
=======================================
  Coverage   12.06%   12.06%           
=======================================
  Files           6        6           
  Lines         895      895           
=======================================
  Hits          108      108           
  Misses        783      783           
  Partials        4        4           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8552a8f...a3f6661. Read the comment docs.

@pmatseykanets pmatseykanets merged commit 0652ebe into master Oct 16, 2021
@pmatseykanets pmatseykanets deleted the readpassword-windows branch October 16, 2021 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant