github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/cmds/exp/pflask/termios.go (about)

     1  // Copyright 2015-2017 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"log"
     9  
    10  	"github.com/u-root/u-root/pkg/termios"
    11  )
    12  
    13  func raw() {
    14  	// we don't set raw until the very last, so if they see an issue they can hit ^C
    15  	t, err := termios.GetTermios(1)
    16  	if err != nil {
    17  		log.Fatalf(err.Error())
    18  	}
    19  	raw := termios.MakeRaw(t)
    20  	if err = termios.SetTermios(1, raw); err != nil {
    21  		log.Fatalf(err.Error())
    22  	}
    23  }