INNER CODE UNIT · Go

func

umputun/spot · cmd/spot/main.go:642

func (p *defaultUserInfoProvider) Current() (*user.User, error) {
	return user.Current()
}

// readPasswordFromStdin reads a password from stdin without echoing it
func readPasswordFromStdin(prompt string) (string, error) {
	// check if stdin is a terminal
	if !term.IsTerminal(int(os.Stdin.Fd())) {
		// not a terminal, read directly (for piped input)
		var password string
		if _, err := fmt.Scanln(&password); err != nil && err != io.EOF {
			return "", err
		}
		return password, nil
	}

	// terminal input, use secure password reading
	fmt.Fprint(os.Stderr, prompt)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…