github.com/apcera/util@v0.0.0-20180322191801-7a50bc84ee48/terminal/terminal_state.go (about)

     1  // Copyright 2014 Apcera Inc. All rights reserved.
     2  
     3  package terminal
     4  
     5  import "os"
     6  
     7  // TerminalState can be used to restore terminal state.
     8  type TerminalState interface {
     9  	IsValid() bool
    10  	Restore()
    11  }
    12  
    13  func GetTerminalState() (TerminalState, error) {
    14  	return getOSTerminalState()
    15  }
    16  
    17  var stdoutIsTTY = Isatty(os.Stdout.Fd())