Skip to content

Commit 3a475aa

Browse files
committed
Fix #194, give raw terminal ability to skip capturing overflow in cases where it doesnt have overflow
1 parent e1bc8a1 commit 3a475aa

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

internal/server/commands/access.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ func (s *access) Run(user *users.User, tty io.ReadWriter, line terminal.ParsedLi
7373
_, err := tty.Read(b)
7474
if err != nil {
7575
if term, ok := tty.(*terminal.Terminal); ok {
76-
term.DisableRaw()
76+
term.DisableRaw(false)
7777
}
7878
return err
7979
}
8080
if term, ok := tty.(*terminal.Terminal); ok {
81-
term.DisableRaw()
81+
term.DisableRaw(false)
8282
}
8383

8484
if !(b[0] == 'y' || b[0] == 'Y') {
@@ -96,7 +96,7 @@ func (s *access) Run(user *users.User, tty io.ReadWriter, line terminal.ParsedLi
9696
changes++
9797
}
9898

99-
return fmt.Errorf("%d client owners modified", changes)
99+
return fmt.Errorf("\n%d client owners modified", changes)
100100
}
101101

102102
func (s *access) ValidArgs() map[string]string {

internal/server/commands/connect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (c *connect) Run(user *users.User, tty io.ReadWriter, line terminal.ParsedL
7373

7474
defer func() {
7575
c.log.Info("Disconnected from remote host %s (%s)", target.RemoteAddr(), target.ClientVersion())
76-
term.DisableRaw()
76+
term.DisableRaw(true)
7777
}()
7878

7979
//Attempt to connect to remote host and send inital pty request and screen size

internal/server/commands/exec.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ func (e *exec) Run(user *users.User, tty io.ReadWriter, line terminal.ParsedLine
5858
_, err := tty.Read(b)
5959
if err != nil {
6060
if term, ok := tty.(*terminal.Terminal); ok {
61-
term.DisableRaw()
61+
term.DisableRaw(false)
6262
}
6363
return err
6464
}
6565
if term, ok := tty.(*terminal.Terminal); ok {
66-
term.DisableRaw()
66+
term.DisableRaw(false)
6767
}
6868

6969
if !(b[0] == 'y' || b[0] == 'Y') {

internal/server/commands/kill.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ func (k *kill) Run(user *users.User, tty io.ReadWriter, line terminal.ParsedLine
4646
_, err := tty.Read(b)
4747
if err != nil {
4848
if term, ok := tty.(*terminal.Terminal); ok {
49-
term.DisableRaw()
49+
term.DisableRaw(false)
5050
}
5151
return err
5252
}
5353
if term, ok := tty.(*terminal.Terminal); ok {
54-
term.DisableRaw()
54+
term.DisableRaw(false)
5555
}
5656

5757
if !(b[0] == 'y' || b[0] == 'Y') {

internal/server/commands/log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (l *logCommand) Run(user *users.User, tty io.ReadWriter, line terminal.Pars
8989
}
9090

9191
if isTerm {
92-
term.DisableRaw()
92+
term.DisableRaw(false)
9393
}
9494

9595
} else if line.IsSet("to-file") {

internal/server/commands/watch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (w *watch) Run(user *users.User, tty io.ReadWriter, line terminal.ParsedLin
154154
}
155155

156156
if isTerm {
157-
term.DisableRaw()
157+
term.DisableRaw(false)
158158
}
159159

160160
return nil

internal/terminal/terminal.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,14 @@ func (t *Terminal) EnableRaw() {
138138
}
139139
}
140140

141-
func (t *Terminal) DisableRaw() {
141+
func (t *Terminal) DisableRaw(captureOverflow bool) {
142142
t.lock.Lock()
143143
defer t.lock.Unlock()
144144

145145
if t.raw {
146-
t.rawOverflow = make(chan []byte, 1)
146+
if captureOverflow {
147+
t.rawOverflow = make(chan []byte, 1)
148+
}
147149

148150
t.raw = false
149151

0 commit comments

Comments
 (0)