mirror of
https://github.com/cloudflare/redoctober.git
synced 2026-01-07 05:56:56 +00:00
Ran goimports on the whole project. No functional changes
This commit is contained in:
@@ -34,7 +34,7 @@ func NewRemoteServer(serverAddress, CAFile string) (*RemoteServer, error) {
|
||||
}
|
||||
ok := rootCAs.AppendCertsFromPEM(pemBytes)
|
||||
if !ok {
|
||||
return nil, errors.New("fail to populate CA root pool.")
|
||||
return nil, errors.New("fail to populate CA root pool")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,21 +23,21 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
sttyArg0 = "/bin/stty"
|
||||
sttyArg0 = "/bin/stty"
|
||||
execCwdir = ""
|
||||
)
|
||||
|
||||
// Tells the terminal to turn echo off.
|
||||
var sttyArgvEOff []string = []string{"stty", "-echo"}
|
||||
var sttyArgvEOff = []string{"stty", "-echo"}
|
||||
|
||||
// Tells the terminal to turn echo on.
|
||||
var sttyArgvEOn []string = []string{"stty", "echo"}
|
||||
var sttyArgvEOn = []string{"stty", "echo"}
|
||||
|
||||
var ws syscall.WaitStatus
|
||||
|
||||
// GetPass gets input hidden from the terminal from a user.
|
||||
// This is accomplished by turning off terminal echo,
|
||||
// reading input from the user and finally turning on terminal echo.
|
||||
// reading input from the user and finally turning on terminal echo.
|
||||
// prompt is a string to display before the user's input.
|
||||
func GetPass(prompt string) (passwd string, err error) {
|
||||
sig := make(chan os.Signal, 10)
|
||||
@@ -52,7 +52,7 @@ func GetPass(prompt string) (passwd string, err error) {
|
||||
// Setup notifications of termination signals to channel sig, create a process to
|
||||
// watch for these signals so we can turn back on echo if need be.
|
||||
signal.Notify(sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGKILL, syscall.SIGQUIT,
|
||||
syscall.SIGTERM)
|
||||
syscall.SIGTERM)
|
||||
go catchSignal(fd, sig, brk)
|
||||
|
||||
// Turn off the terminal echo.
|
||||
@@ -91,11 +91,11 @@ func echoOff(fd []uintptr) (int, error) {
|
||||
|
||||
// echoOn turns back on the terminal echo.
|
||||
func echoOn(fd []uintptr) {
|
||||
// Turn on the terminal echo.
|
||||
pid, e := syscall.ForkExec(sttyArg0, sttyArgvEOn, &syscall.ProcAttr{Dir: execCwdir, Files: fd})
|
||||
if e == nil {
|
||||
syscall.Wait4(pid, &ws, 0, nil)
|
||||
}
|
||||
// Turn on the terminal echo.
|
||||
pid, e := syscall.ForkExec(sttyArg0, sttyArgvEOn, &syscall.ProcAttr{Dir: execCwdir, Files: fd})
|
||||
if e == nil {
|
||||
syscall.Wait4(pid, &ws, 0, nil)
|
||||
}
|
||||
}
|
||||
|
||||
// catchSignal tries to catch SIGKILL, SIGQUIT and SIGINT so that we can turn terminal
|
||||
@@ -108,4 +108,4 @@ func catchSignal(fd []uintptr, sig chan os.Signal, brk chan bool) {
|
||||
os.Exit(-1)
|
||||
case <-brk:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user