github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/shell/internal/termsession/termsession_unix.go (about)

     1  // +build !windows
     2  
     3  package termsession
     4  
     5  import (
     6  	"os"
     7  	"os/signal"
     8  	"syscall"
     9  )
    10  
    11  func (t *TermSession) start() {
    12  	t.watcher = make(chan os.Signal, 1)
    13  	signal.Notify(t.watcher, syscall.SIGWINCH)
    14  }
    15  
    16  func (t *TermSession) watchResize() {
    17  	t.Resize()
    18  
    19  	for {
    20  		select {
    21  		case <-t.ctx.Done():
    22  			return
    23  		case <-t.watcher:
    24  			t.Resize()
    25  		}
    26  	}
    27  }
    28  
    29  func (t *TermSession) restore() {
    30  	signal.Stop(t.watcher)
    31  }