File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -82,12 +82,6 @@ type Session interface {
82
82
// the request handling loop. Registering nil will unregister the channel.
83
83
// During the time that no channel is registered, breaks are ignored.
84
84
Break (c chan <- bool )
85
-
86
- // Stderr returns an io.ReadWriter that writes to this channel
87
- // with the extended data type set to stderr. Stderr may
88
- // safely be read and written from a different goroutine than
89
- // Read and Write respectively.
90
- Stderr () io.ReadWriter
91
85
}
92
86
93
87
// maxSigBufSize is how many signals will be buffered
Original file line number Diff line number Diff line change @@ -108,6 +108,30 @@ func TestStderr(t *testing.T) {
108
108
}
109
109
}
110
110
111
+ func TestPtyStderr (t * testing.T ) {
112
+ t .Parallel ()
113
+ testBytes := []byte ("Hello world\n \r \n " )
114
+ expectBytes := []byte ("Hello world\r \n \r \n " )
115
+ session , _ , cleanup := newTestSession (t , & Server {
116
+ Handler : func (s Session ) {
117
+ s .Stderr ().Write (testBytes )
118
+ },
119
+ }, nil )
120
+ err := session .RequestPty ("xterm" , 80 , 40 , nil )
121
+ if err != nil {
122
+ t .Fatal (err )
123
+ }
124
+ defer cleanup ()
125
+ var stderr bytes.Buffer
126
+ session .Stderr = & stderr
127
+ if err := session .Run ("" ); err != nil {
128
+ t .Fatal (err )
129
+ }
130
+ if ! bytes .Equal (stderr .Bytes (), expectBytes ) {
131
+ t .Fatalf ("stderr = %#v; want %#v" , stderr .Bytes (), expectBytes )
132
+ }
133
+ }
134
+
111
135
func TestStdin (t * testing.T ) {
112
136
t .Parallel ()
113
137
testBytes := []byte ("Hello world\n " )
You can’t perform that action at this time.
0 commit comments