summaryrefslogtreecommitdiff
path: root/classes/Net/SSH/Multi/Channel.html
blob: e535eb355531123ef6642170a763d588fc022a97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
  <head>
    <title>Net::SSH::Multi::Channel</title>
    <meta content='text/html; charset=US-ASCII' http-equiv='Content-Type'>
    <link href='../../../../css/style.css' media='screen' rel='stylesheet' type='text/css'>
    <script type='text/javascript'>
      //<![CDATA[
        function popupCode(url) {
          window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
        }
        
        function toggleCode(id) {
          var code = document.getElementById(id)
        
          code.style.display = code.style.display != 'block' ? 'block' : 'none'
          return true
        }
        
        // Make codeblocks hidden by default
        document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
      //]]>
    </script>
  </head>
  <body class='page'>
    <div class='class' id='wrapper'>
      <div class='header'>
        <h1 class='name'>
          <span class='type'>class</span>
          Net::SSH::Multi::Channel
        </h1>
        <ol class='paths'>
          <li>
            <a target="docwin" href="../../../../files/lib/net/ssh/multi/channel_rb.html">lib/net/ssh/multi/channel.rb</a>
          </li>
        </ol>
        <div class='parent'>
          Parent:
          <strong><a target="docwin" href="../Multi.html">Multi</a></strong>
        </div>
      </div>
      <div id='content'>
        <div id='text'>
          <div id='description'>
            
            <p><a href="Channel.html">Net::SSH::Multi::Channel</a> encapsulates a
            collection of Net::SSH::Connection::Channel instances from multiple
            different connections. It allows for operations to be performed on all
            contained channels, simultaneously, using an interface mostly identical to
            Net::SSH::Connection::Channel itself.</p>
            
            <p>You typically obtain a <a href="Channel.html">Net::SSH::Multi::Channel</a>
            instance via <a
            href="SessionActions.html#method-i-open_channel">Net::SSH::Multi::SessionActions#open_channel</a>
            or <a
            href="SessionActions.html#method-i-exec">Net::SSH::Multi::SessionActions#exec</a>,
            though there is nothing stopping you from instantiating one yourself with a
            handful of Net::SSH::Connection::Channel objects (though they should be
            associated with connections managed by a <a
            href="Session.html">Net::SSH::Multi::Session</a> object for consistent
            behavior).</p>
            
            <pre class="ruby"><span class="ruby-identifier">channel</span> = <span class="ruby-identifier">session</span>.<span class="ruby-identifier">open_channel</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-comment"># ...</span>&#x000A;<span class="ruby-keyword">end</span>&#x000A;&#x000A;<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">wait</span></pre>
          </div>
          <div id='method-list'>
            <h2>Methods</h2>
            <h3>Public Class</h3>
            <ol>
              <li><a target="docwin" href="#method-c-new">new</a></li>
            </ol>
            <h3>Public Instance</h3>
            <ol>
              <li><a target="docwin" href="#method-i-5B-5D">[]</a></li>
              <li><a target="docwin" href="#method-i-5B-5D-3D">[]=</a></li>
              <li><a target="docwin" href="#method-i-active-3F">active?</a></li>
              <li><a target="docwin" href="#attribute-i-channels">channels</a></li>
              <li><a target="docwin" href="#method-i-close">close</a></li>
              <li><a target="docwin" href="#attribute-i-connection">connection</a></li>
              <li><a target="docwin" href="#method-i-each">each</a></li>
              <li><a target="docwin" href="#method-i-eof-21">eof!</a></li>
              <li><a target="docwin" href="#method-i-exec">exec</a></li>
              <li><a target="docwin" href="#method-i-on_close">on_close</a></li>
              <li><a target="docwin" href="#method-i-on_data">on_data</a></li>
              <li><a target="docwin" href="#method-i-on_eof">on_eof</a></li>
              <li><a target="docwin" href="#method-i-on_extended_data">on_extended_data</a></li>
              <li><a target="docwin" href="#method-i-on_open_failed">on_open_failed</a></li>
              <li><a target="docwin" href="#method-i-on_process">on_process</a></li>
              <li><a target="docwin" href="#method-i-on_request">on_request</a></li>
              <li><a target="docwin" href="#attribute-i-properties">properties</a></li>
              <li><a target="docwin" href="#method-i-request_pty">request_pty</a></li>
              <li><a target="docwin" href="#method-i-send_data">send_data</a></li>
              <li><a target="docwin" href="#method-i-wait">wait</a></li>
            </ol>
          </div>
          <div id='context'>
            <div id='includes'>
              <h2>Included modules</h2>
              <ol>
                <li>Enumerable</li>
              </ol>
            </div>
          </div>
          <div id='section'>
            <div id='attribute-list'>
              <h2 class='section-bar'>Attributes</h2>
              <div class='name-list'>
                <table>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-channels'>channels</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <p>The collection of Net::SSH::Connection::Channel instances that this
                      multi-channel aggregates.</p>
                    </td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-connection'>connection</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <p>The <a href="Session.html">Net::SSH::Multi::Session</a> instance that
                      controls this channel collection.</p>
                    </td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-properties'>properties</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <p>A Hash of custom properties that may be set and queried on this object.</p>
                    </td>
                  </tr>
                </table>
              </div>
            </div>
            <div id='methods'>
              <h2>Public Class methods</h2>
              <div class='method public-class' id='method-method-c-new'>
                <a name='method-c-new'></a>
                <div class='synopsis'>
                  <span class='name'>new</span>
                  <span class='arguments'>(connection, channels)</span>
                </div>
                <div class='description'>
                  
                  <p>Instantiate a new <a href="Channel.html">Net::SSH::Multi::Channel</a>
                  instance, controlled by the given <code>connection</code> (a <a
                  href="Session.html">Net::SSH::Multi::Session</a> object) and wrapping the
                  given <code>channels</code> (Net::SSH::Connection::Channel instances).</p>
                  
                  <p>You will typically never call this directly; rather, you'll get your
                  multi-channel references via <a
                  href="SessionActions.html#method-i-open_channel">Net::SSH::Multi::SessionActions#open_channel</a>
                  and friends.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-c-new-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-c-new-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 38</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">connection</span>, <span class="ruby-identifier">channels</span>)&#x000A;  <span class="ruby-ivar">@connection</span> = <span class="ruby-identifier">connection</span>&#x000A;  <span class="ruby-ivar">@channels</span> = <span class="ruby-identifier">channels</span>&#x000A;  <span class="ruby-ivar">@properties</span> = {}&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <h2>Public Instance methods</h2>
              <div class='method public-instance' id='method-method-i-5B-5D'>
                <a name='method-i-5B-5D'></a>
                <div class='synopsis'>
                  <span class='name'>[]</span>
                  <span class='arguments'>(key)</span>
                </div>
                <div class='description'>
                  
                  <p>Retrieve the property (see <a
                  href="Channel.html#attribute-i-properties">properties</a>) with the given
                  <code>key</code>.</p>
                  
                  <pre>host = channel[:host]</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-5B-5D-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-5B-5D-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 53</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)&#x000A;  <span class="ruby-ivar">@properties</span>[<span class="ruby-identifier">key</span>]&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-5B-5D-3D'>
                <a name='method-i-5B-5D-3D'></a>
                <div class='synopsis'>
                  <span class='name'>[]=</span>
                  <span class='arguments'>(key, value)</span>
                </div>
                <div class='description'>
                  
                  <p>Set the property (see <a
                  href="Channel.html#attribute-i-properties">properties</a>) with the given
                  <code>key</code> to the given <code>value</code>.</p>
                  
                  <pre>channel[:visited] = true</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-5B-5D-3D-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-5B-5D-3D-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 61</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)&#x000A;  <span class="ruby-ivar">@properties</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-active-3F'>
                <a name='method-i-active-3F'></a>
                <div class='synopsis'>
                  <span class='name'>active?</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Returns true as long as any of the component channels are active.</p>
                  
                  <pre>connection.loop { channel.active? }</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-active-3F-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-active-3F-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 112</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">active?</span>&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">active?</span> }&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-close'>
                <a name='method-i-close'></a>
                <div class='synopsis'>
                  <span class='name'>close</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Closes all component channels.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-close-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-close-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 127</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">close</span> }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-each'>
                <a name='method-i-each'></a>
                <div class='synopsis'>
                  <span class='name'>each</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Iterate over each component channel object, yielding each in order to the
                  associated block.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-each-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-each-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 46</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">each</span>&#x000A;  <span class="ruby-ivar">@channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">channel</span> }&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-eof-21'>
                <a name='method-i-eof-21'></a>
                <div class='synopsis'>
                  <span class='name'>eof!</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Tells the remote process for each component channel not to expect any
                  further data from this end of the channel.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-eof-21-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-eof-21-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 134</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">eof!</span>&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">eof!</span> }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-exec'>
                <a name='method-i-exec'></a>
                <div class='synopsis'>
                  <span class='name'>exec</span>
                  <span class='arguments'>(command, &block)</span>
                </div>
                <div class='description'>
                  
                  <p>Perform an <code>exec</code> command on all component channels. The block,
                  if given, is passed to each component channel, so it will (potentially) be
                  invoked once for every channel in the collection. The block will receive
                  two parameters: the specific channel object being operated on, and a
                  boolean indicating whether the exec succeeded or not.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">exec</span> <span class="ruby-string">&quot;ls -l&quot;</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">success</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-comment"># ...</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                  
                  <p>See the documentation in <a href="../../SSH.html">Net::SSH</a> for
                  Net::SSH::Connection::Channel#exec for more information on how to work with
                  the callback.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-exec-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-exec-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 77</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec</span>(<span class="ruby-identifier">command</span>, &amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">exec</span>(<span class="ruby-identifier">command</span>, &amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-on_close'>
                <a name='method-i-on_close'></a>
                <div class='synopsis'>
                  <span class='name'>on_close</span>
                  <span class='arguments'>(&block)</span>
                </div>
                <div class='description'>
                  
                  <p>Registers a callback on all component channels, to be invoked when the
                  remote server terminates the channel. The callback will be invoked with one
                  argument: the specific channel object being closed.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_close</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-comment"># ...</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-on_close-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-on_close-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 185</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">on_close</span>(&amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_close</span>(&amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-on_data'>
                <a name='method-i-on_data'></a>
                <div class='synopsis'>
                  <span class='name'>on_data</span>
                  <span class='arguments'>(&block)</span>
                </div>
                <div class='description'>
                  
                  <p>Registers a callback on all component channels, to be invoked when the
                  remote process emits data (usually on its <code>stdout</code> stream). The
                  block will be invoked with two arguments: the specific channel object, and
                  the data that was received.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_data</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">data</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;got data: #{data}&quot;</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-on_data-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-on_data-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 147</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">on_data</span>(&amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_data</span>(&amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-on_eof'>
                <a name='method-i-on_eof'></a>
                <div class='synopsis'>
                  <span class='name'>on_eof</span>
                  <span class='arguments'>(&block)</span>
                </div>
                <div class='description'>
                  
                  <p>Registers a callback on all component channels, to be invoked when the
                  remote server has no further data to send. The callback will be invoked
                  with one argument: the specific channel object being marked EOF.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_eof</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-comment"># ...</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-on_eof-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-on_eof-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 197</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">on_eof</span>(&amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_eof</span>(&amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-on_extended_data'>
                <a name='method-i-on_extended_data'></a>
                <div class='synopsis'>
                  <span class='name'>on_extended_data</span>
                  <span class='arguments'>(&block)</span>
                </div>
                <div class='description'>
                  
                  <p>Registers a callback on all component channels, to be invoked when the
                  remote process emits "extended" data (typically on its <code>stderr</code>
                  stream). The block will be invoked with three arguments: the specific
                  channel object, an integer describing the data type (usually a 1 for
                  <code>stderr</code>) and the data that was received.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_extended_data</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">type</span>, <span class="ruby-identifier">data</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;got extended data: #{data}&quot;</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-on_extended_data-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-on_extended_data-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 161</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">on_extended_data</span>(&amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_extended_data</span>(&amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-on_open_failed'>
                <a name='method-i-on_open_failed'></a>
                <div class='synopsis'>
                  <span class='name'>on_open_failed</span>
                  <span class='arguments'>(&block)</span>
                </div>
                <div class='description'>
                  
                  <p>Registers a callback on all component channels, to be invoked when the
                  remote server is unable to open the channel. The callback will be invoked
                  with three arguments: the channel object that couldn't be opened, a
                  description of the error (as a string), and an integer code representing
                  the error.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_open_failed</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">description</span>, <span class="ruby-identifier">code</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-comment"># ...</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-on_open_failed-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-on_open_failed-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 211</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">on_open_failed</span>(&amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_open_failed</span>(&amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-on_process'>
                <a name='method-i-on_process'></a>
                <div class='synopsis'>
                  <span class='name'>on_process</span>
                  <span class='arguments'>(&block)</span>
                </div>
                <div class='description'>
                  
                  <p>Registers a callback on all component channels, to be invoked during the
                  idle portion of the connection event loop. The callback will be invoked
                  with one argument: the specific channel object being processed.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_process</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-comment"># ...</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-on_process-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-on_process-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 173</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">on_process</span>(&amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_process</span>(&amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-on_request'>
                <a name='method-i-on_request'></a>
                <div class='synopsis'>
                  <span class='name'>on_request</span>
                  <span class='arguments'>(type, &block)</span>
                </div>
                <div class='description'>
                  
                  <p>Registers a callback on all component channels, to be invoked when the
                  remote server sends a channel request of the given <code>type</code>. The
                  callback will be invoked with two arguments: the specific channel object
                  receiving the request, and a Net::SSH::Buffer instance containing the
                  request-specific data.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_request</span>(<span class="ruby-string">&quot;exit-status&quot;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">data</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;exited with #{data.read_long}&quot;</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-on_request-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-on_request-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 225</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">on_request</span>(<span class="ruby-identifier">type</span>, &amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_request</span>(<span class="ruby-identifier">type</span>, &amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-request_pty'>
                <a name='method-i-request_pty'></a>
                <div class='synopsis'>
                  <span class='name'>request_pty</span>
                  <span class='arguments'>(opts={}, &block)</span>
                </div>
                <div class='description'>
                  
                  <p>Perform a <code>request_pty</code> command on all component channels. The
                  block, if given, is passed to each component channel, so it will
                  (potentially) be invoked once for every channel in the collection. The
                  block will receive two parameters: the specific channel object being
                  operated on, and a boolean indicating whether the pty request succeeded or
                  not.</p>
                  
                  <pre class="ruby"><span class="ruby-identifier">channel</span>.<span class="ruby-identifier">request_pty</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">success</span><span class="ruby-operator">|</span>&#x000A;  <span class="ruby-comment"># ...</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                  
                  <p>See the documentation in <a href="../../SSH.html">Net::SSH</a> for
                  Net::SSH::Connection::Channel#request_pty for more information on how to
                  work with the callback.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-request_pty-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-request_pty-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 95</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">request_pty</span>(<span class="ruby-identifier">opts</span>={}, &amp;<span class="ruby-identifier">block</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">request_pty</span>(<span class="ruby-identifier">opts</span>, &amp;<span class="ruby-identifier">block</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-send_data'>
                <a name='method-i-send_data'></a>
                <div class='synopsis'>
                  <span class='name'>send_data</span>
                  <span class='arguments'>(data)</span>
                </div>
                <div class='description'>
                  
                  <p>Send the given <code>data</code> to each component channel. It will be sent
                  to the remote process, typically being received on the process'
                  <code>stdin</code> stream.</p>
                  
                  <pre>channel.send_data &quot;password\n&quot;</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-send_data-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-send_data-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 104</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">send_data</span>(<span class="ruby-identifier">data</span>)&#x000A;  <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">send_data</span>(<span class="ruby-identifier">data</span>) }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-wait'>
                <a name='method-i-wait'></a>
                <div class='synopsis'>
                  <span class='name'>wait</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Runs the connection's event loop until the channel is no longer active (see
                  <a href="Channel.html#method-i-active-3F">active?</a>).</p>
                  
                  <pre>channel.exec &quot;something&quot;&#x000A;channel.wait</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-wait-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-wait-source'><span class="ruby-comment"># File lib/net/ssh/multi/channel.rb, line 121</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">wait</span>&#x000A;  <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">loop</span> { <span class="ruby-identifier">active?</span> }&#x000A;  <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div id='footer-push'></div>
    </div>
    <div id='footer'>
      <a target="docwin" href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
    </div>
  </body>
</html>