Skip to content

Instantly share code, notes, and snippets.

View btwiuse's full-sized avatar
🏠
Working from home

btwiuse

🏠
Working from home
View GitHub Profile
@btwiuse
btwiuse / getPassword.go
Created January 30, 2020 09:09 — forked from jlinoff/getPassword.go
Go code to prompt for password using only standard packages by utilizing syscall.ForkExec() and syscall.Wait4(), recovers from ^C gracefully.
// License: MIT Open Source
// Copyright (c) Joe Linoff 2016
// Go code to prompt for password using only standard packages by utilizing syscall.ForkExec() and syscall.Wait4().
// Correctly resets terminal echo after ^C interrupts.
package main
import (
"bufio"
"fmt"
"os"