Skip to content

Commit

Permalink
terminal raw mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cheggaaa committed Dec 17, 2014
1 parent 868ac58 commit b2aef60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pb

import (
"fmt"
"golang.org/x/crypto/ssh/terminal"
"time"
)

Expand All @@ -27,9 +28,13 @@ func (p *Pool) Start() {
func (p *Pool) writer() {
var first = true
var out string
if oldState, err := terminal.MakeRaw(0); err != nil {
panic(err)
} else {
defer terminal.Restore(0, oldState)
}
for {
if first {
out = ""
first = false
} else {
out = fmt.Sprintf("\033[%dA", len(p.bars))
Expand Down

0 comments on commit b2aef60

Please sign in to comment.