caliph 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/doc/Caliph/CommandChain.html +532 -0
- data/doc/Caliph/CommandLine.html +2541 -0
- data/doc/Caliph/CommandLineDSL.html +230 -0
- data/doc/Caliph/CommandLineExampleGroup/MockingExecute.html +174 -0
- data/doc/Caliph/CommandLineExampleGroup.html +366 -0
- data/doc/Caliph/CommandRunResult.html +1124 -0
- data/doc/Caliph/DefineOp/ClassMethods.html +250 -0
- data/doc/Caliph/DefineOp.html +188 -0
- data/doc/Caliph/MockCommandResult.html +465 -0
- data/doc/Caliph/PipelineChain.html +242 -0
- data/doc/Caliph/PrereqChain.html +242 -0
- data/doc/Caliph/ShellEscaped.html +445 -0
- data/doc/Caliph/WrappingChain.html +242 -0
- data/doc/Caliph.html +119 -0
- data/doc/_index.html +241 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +235 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +235 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +503 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/caliph/command-chain.rb +4 -1
- data/lib/caliph/command-line.rb +24 -81
- data/lib/caliph/command-run-result.rb +48 -7
- data/lib/caliph/shell.rb +172 -0
- data/lib/caliph.rb +9 -0
- data/spec/command-line-dsl.rb +15 -15
- data/spec/command-line.rb +16 -18
- data/spec_help/spec_helper.rb +9 -3
- metadata +63 -6
@@ -0,0 +1,2541 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Caliph::CommandLine
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Caliph/CommandLine.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Caliph.html" title="Caliph (module)">Caliph</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">CommandLine</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Caliph::CommandLine
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Caliph::CommandLine</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<dt class="r2">Includes:</dt>
|
94
|
+
<dd class="r2"><span class='object_link'><a href="DefineOp.html" title="Caliph::DefineOp (module)">DefineOp</a></span></dd>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dt class="r1 last">Defined in:</dt>
|
101
|
+
<dd class="r1 last">lib/caliph/command-line.rb<span class="defines">,<br />
|
102
|
+
lib/caliph/testing/record-commands.rb,<br /> lib/caliph/testing/mock-command-line.rb</span>
|
103
|
+
</dd>
|
104
|
+
|
105
|
+
</dl>
|
106
|
+
<div class="clear"></div>
|
107
|
+
|
108
|
+
<div id="subclasses">
|
109
|
+
<h2>Direct Known Subclasses</h2>
|
110
|
+
<p class="children"><span class='object_link'><a href="CommandChain.html" title="Caliph::CommandChain (class)">CommandChain</a></span>, <span class='object_link'><a href="ShellEscaped.html" title="Caliph::ShellEscaped (class)">ShellEscaped</a></span></p>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
<h2>Constant Summary</h2>
|
114
|
+
|
115
|
+
<dl class="constants">
|
116
|
+
|
117
|
+
<dt id="commands-classvariable" class="">@@commands =
|
118
|
+
|
119
|
+
</dt>
|
120
|
+
<dd><pre class="code"><span class='lbracket'>[</span><span class='rbracket'>]</span></pre></dd>
|
121
|
+
|
122
|
+
</dl>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<h2>Class Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
129
|
+
<ul class="summary">
|
130
|
+
|
131
|
+
<li class="public ">
|
132
|
+
<span class="summary_signature">
|
133
|
+
|
134
|
+
<a href="#command_recording_path-class_method" title="command_recording_path (class method)">+ (Object) <strong>command_recording_path</strong> </a>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<span class="summary_desc"><div class='inline'>
|
152
|
+
<p>Returns the value of attribute command_recording_path.</p>
|
153
|
+
</div></span>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
|
158
|
+
<li class="public ">
|
159
|
+
<span class="summary_signature">
|
160
|
+
|
161
|
+
<a href="#output_stream-class_method" title="output_stream (class method)">+ (Object) <strong>output_stream</strong> </a>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'>
|
179
|
+
<p>Returns the value of attribute output_stream.</p>
|
180
|
+
</div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
</ul>
|
186
|
+
|
187
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
188
|
+
<ul class="summary">
|
189
|
+
|
190
|
+
<li class="public ">
|
191
|
+
<span class="summary_signature">
|
192
|
+
|
193
|
+
<a href="#env-instance_method" title="#env (instance method)">- (Object) <strong>env</strong> </a>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
(also: #command_environment)
|
198
|
+
|
199
|
+
</span>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<span class="summary_desc"><div class='inline'>
|
213
|
+
<p>Returns the value of attribute env.</p>
|
214
|
+
</div></span>
|
215
|
+
|
216
|
+
</li>
|
217
|
+
|
218
|
+
|
219
|
+
<li class="public ">
|
220
|
+
<span class="summary_signature">
|
221
|
+
|
222
|
+
<a href="#executable-instance_method" title="#executable (instance method)">- (Object) <strong>executable</strong> </a>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
</span>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<span class="summary_desc"><div class='inline'>
|
240
|
+
<p>Returns the value of attribute executable.</p>
|
241
|
+
</div></span>
|
242
|
+
|
243
|
+
</li>
|
244
|
+
|
245
|
+
|
246
|
+
<li class="public ">
|
247
|
+
<span class="summary_signature">
|
248
|
+
|
249
|
+
<a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong> </a>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
</span>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
<span class="summary_desc"><div class='inline'>
|
267
|
+
<p>Returns the value of attribute name.</p>
|
268
|
+
</div></span>
|
269
|
+
|
270
|
+
</li>
|
271
|
+
|
272
|
+
|
273
|
+
<li class="public ">
|
274
|
+
<span class="summary_signature">
|
275
|
+
|
276
|
+
<a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
</span>
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
<span class="summary_desc"><div class='inline'>
|
294
|
+
<p>Returns the value of attribute options.</p>
|
295
|
+
</div></span>
|
296
|
+
|
297
|
+
</li>
|
298
|
+
|
299
|
+
|
300
|
+
<li class="public ">
|
301
|
+
<span class="summary_signature">
|
302
|
+
|
303
|
+
<a href="#output_stream-instance_method" title="#output_stream (instance method)">- (Object) <strong>output_stream</strong> </a>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
</span>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
<span class="summary_desc"><div class='inline'>
|
321
|
+
<p>Returns the value of attribute output_stream.</p>
|
322
|
+
</div></span>
|
323
|
+
|
324
|
+
</li>
|
325
|
+
|
326
|
+
|
327
|
+
<li class="public ">
|
328
|
+
<span class="summary_signature">
|
329
|
+
|
330
|
+
<a href="#redirections-instance_method" title="#redirections (instance method)">- (Object) <strong>redirections</strong> </a>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</span>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
<span class="note title readonly">readonly</span>
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
<span class="summary_desc"><div class='inline'>
|
350
|
+
<p>Returns the value of attribute redirections.</p>
|
351
|
+
</div></span>
|
352
|
+
|
353
|
+
</li>
|
354
|
+
|
355
|
+
|
356
|
+
</ul>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
<h2>
|
363
|
+
Class Method Summary
|
364
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
365
|
+
</h2>
|
366
|
+
|
367
|
+
<ul class="summary">
|
368
|
+
|
369
|
+
<li class="public ">
|
370
|
+
<span class="summary_signature">
|
371
|
+
|
372
|
+
<a href="#emit_recording-class_method" title="emit_recording (class method)">+ (Object) <strong>emit_recording</strong> </a>
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
</span>
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
387
|
+
|
388
|
+
</li>
|
389
|
+
|
390
|
+
|
391
|
+
<li class="public ">
|
392
|
+
<span class="summary_signature">
|
393
|
+
|
394
|
+
<a href="#execute-class_method" title="execute (class method)">+ (Object) <strong>execute</strong>(*args) </a>
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
</span>
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
409
|
+
|
410
|
+
</li>
|
411
|
+
|
412
|
+
|
413
|
+
</ul>
|
414
|
+
|
415
|
+
<h2>
|
416
|
+
Instance Method Summary
|
417
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
418
|
+
</h2>
|
419
|
+
|
420
|
+
<ul class="summary">
|
421
|
+
|
422
|
+
<li class="public ">
|
423
|
+
<span class="summary_signature">
|
424
|
+
|
425
|
+
<a href="#collect_result-instance_method" title="#collect_result (instance method)">- (Object) <strong>collect_result</strong>(pid, host_stdout, host_stderr) </a>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
</span>
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
<span class="summary_desc"><div class='inline'>
|
440
|
+
<p>Given a process ID for a running command and a pair of stdout/stdin
|
441
|
+
streams, records the results of the command and returns them in a
|
442
|
+
CommandRunResult instance.</p>
|
443
|
+
</div></span>
|
444
|
+
|
445
|
+
</li>
|
446
|
+
|
447
|
+
|
448
|
+
<li class="public ">
|
449
|
+
<span class="summary_signature">
|
450
|
+
|
451
|
+
<a href="#command-instance_method" title="#command (instance method)">- (Object) <strong>command</strong> </a>
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
</span>
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
<span class="summary_desc"><div class='inline'>
|
466
|
+
<p>The command as a string, including arguments and options.</p>
|
467
|
+
</div></span>
|
468
|
+
|
469
|
+
</li>
|
470
|
+
|
471
|
+
|
472
|
+
<li class="public ">
|
473
|
+
<span class="summary_signature">
|
474
|
+
|
475
|
+
<a href="#complete-instance_method" title="#complete (instance method)">- (Object) <strong>complete</strong>(pid, out, err) </a>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
</span>
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
490
|
+
|
491
|
+
</li>
|
492
|
+
|
493
|
+
|
494
|
+
<li class="public ">
|
495
|
+
<span class="summary_signature">
|
496
|
+
|
497
|
+
<a href="#copy_stream_to-instance_method" title="#copy_stream_to (instance method)">- (Object) <strong>copy_stream_to</strong>(from, to) </a>
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
</span>
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
512
|
+
|
513
|
+
</li>
|
514
|
+
|
515
|
+
|
516
|
+
<li class="public ">
|
517
|
+
<span class="summary_signature">
|
518
|
+
|
519
|
+
<a href="#execute-instance_method" title="#execute (instance method)">- (Object) <strong>execute</strong> </a>
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
</span>
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
<span class="summary_desc"><div class='inline'>
|
534
|
+
<p>Run the command, wait for termination, and collect the results.</p>
|
535
|
+
</div></span>
|
536
|
+
|
537
|
+
</li>
|
538
|
+
|
539
|
+
|
540
|
+
<li class="public ">
|
541
|
+
<span class="summary_signature">
|
542
|
+
|
543
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (CommandLine) <strong>initialize</strong>(executable, *options) {|_self| ... }</a>
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
</span>
|
548
|
+
|
549
|
+
|
550
|
+
<span class="note title constructor">constructor</span>
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
<span class="summary_desc"><div class='inline'>
|
560
|
+
<p>A new instance of CommandLine.</p>
|
561
|
+
</div></span>
|
562
|
+
|
563
|
+
</li>
|
564
|
+
|
565
|
+
|
566
|
+
<li class="public ">
|
567
|
+
<span class="summary_signature">
|
568
|
+
|
569
|
+
<a href="#kill_process-instance_method" title="#kill_process (instance method)">- (Object) <strong>kill_process</strong>(pid) </a>
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
</span>
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
584
|
+
|
585
|
+
</li>
|
586
|
+
|
587
|
+
|
588
|
+
<li class="public ">
|
589
|
+
<span class="summary_signature">
|
590
|
+
|
591
|
+
<a href="#must_succeed%21-instance_method" title="#must_succeed! (instance method)">- (Object) <strong>must_succeed!</strong> </a>
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
</span>
|
596
|
+
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
606
|
+
|
607
|
+
</li>
|
608
|
+
|
609
|
+
|
610
|
+
<li class="public ">
|
611
|
+
<span class="summary_signature">
|
612
|
+
|
613
|
+
<a href="#options_composition-instance_method" title="#options_composition (instance method)">- (Object) <strong>options_composition</strong> </a>
|
614
|
+
|
615
|
+
|
616
|
+
|
617
|
+
</span>
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
628
|
+
|
629
|
+
</li>
|
630
|
+
|
631
|
+
|
632
|
+
<li class="public ">
|
633
|
+
<span class="summary_signature">
|
634
|
+
|
635
|
+
<a href="#original_execute-instance_method" title="#original_execute (instance method)">- (Object) <strong>original_execute</strong> </a>
|
636
|
+
|
637
|
+
|
638
|
+
|
639
|
+
</span>
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
<span class="summary_desc"><div class='inline'>
|
650
|
+
<p>Run the command, wait for termination, and collect the results.</p>
|
651
|
+
</div></span>
|
652
|
+
|
653
|
+
</li>
|
654
|
+
|
655
|
+
|
656
|
+
<li class="public ">
|
657
|
+
<span class="summary_signature">
|
658
|
+
|
659
|
+
<a href="#redirect_both-instance_method" title="#redirect_both (instance method)">- (Object) <strong>redirect_both</strong>(path) </a>
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
</span>
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
|
673
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
674
|
+
|
675
|
+
</li>
|
676
|
+
|
677
|
+
|
678
|
+
<li class="public ">
|
679
|
+
<span class="summary_signature">
|
680
|
+
|
681
|
+
<a href="#redirect_from-instance_method" title="#redirect_from (instance method)">- (Object) <strong>redirect_from</strong>(path, stream) </a>
|
682
|
+
|
683
|
+
|
684
|
+
|
685
|
+
</span>
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
696
|
+
|
697
|
+
</li>
|
698
|
+
|
699
|
+
|
700
|
+
<li class="public ">
|
701
|
+
<span class="summary_signature">
|
702
|
+
|
703
|
+
<a href="#redirect_stderr-instance_method" title="#redirect_stderr (instance method)">- (Object) <strong>redirect_stderr</strong>(path) </a>
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
</span>
|
708
|
+
|
709
|
+
|
710
|
+
|
711
|
+
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
718
|
+
|
719
|
+
</li>
|
720
|
+
|
721
|
+
|
722
|
+
<li class="public ">
|
723
|
+
<span class="summary_signature">
|
724
|
+
|
725
|
+
<a href="#redirect_stdin-instance_method" title="#redirect_stdin (instance method)">- (Object) <strong>redirect_stdin</strong>(path) </a>
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
</span>
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
|
739
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
740
|
+
|
741
|
+
</li>
|
742
|
+
|
743
|
+
|
744
|
+
<li class="public ">
|
745
|
+
<span class="summary_signature">
|
746
|
+
|
747
|
+
<a href="#redirect_stdout-instance_method" title="#redirect_stdout (instance method)">- (Object) <strong>redirect_stdout</strong>(path) </a>
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
</span>
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
762
|
+
|
763
|
+
</li>
|
764
|
+
|
765
|
+
|
766
|
+
<li class="public ">
|
767
|
+
<span class="summary_signature">
|
768
|
+
|
769
|
+
<a href="#redirect_to-instance_method" title="#redirect_to (instance method)">- (Object) <strong>redirect_to</strong>(stream, path) </a>
|
770
|
+
|
771
|
+
|
772
|
+
|
773
|
+
</span>
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
|
780
|
+
|
781
|
+
|
782
|
+
|
783
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
784
|
+
|
785
|
+
</li>
|
786
|
+
|
787
|
+
|
788
|
+
<li class="public ">
|
789
|
+
<span class="summary_signature">
|
790
|
+
|
791
|
+
<a href="#report-instance_method" title="#report (instance method)">- (Object) <strong>report</strong>(message, newline = true) </a>
|
792
|
+
|
793
|
+
|
794
|
+
|
795
|
+
</span>
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
|
802
|
+
|
803
|
+
|
804
|
+
|
805
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
806
|
+
|
807
|
+
</li>
|
808
|
+
|
809
|
+
|
810
|
+
<li class="public ">
|
811
|
+
<span class="summary_signature">
|
812
|
+
|
813
|
+
<a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong> </a>
|
814
|
+
|
815
|
+
|
816
|
+
|
817
|
+
</span>
|
818
|
+
|
819
|
+
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
<span class="summary_desc"><div class='inline'>
|
828
|
+
<p>Run the command, wait for termination, and collect the results.</p>
|
829
|
+
</div></span>
|
830
|
+
|
831
|
+
</li>
|
832
|
+
|
833
|
+
|
834
|
+
<li class="public ">
|
835
|
+
<span class="summary_signature">
|
836
|
+
|
837
|
+
<a href="#run_as_replacement-instance_method" title="#run_as_replacement (instance method)">- (Object) <strong>run_as_replacement</strong> </a>
|
838
|
+
|
839
|
+
|
840
|
+
|
841
|
+
(also: #replace_us)
|
842
|
+
|
843
|
+
</span>
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
|
848
|
+
|
849
|
+
|
850
|
+
|
851
|
+
|
852
|
+
|
853
|
+
<span class="summary_desc"><div class='inline'>
|
854
|
+
<p>Fork a new process for the command, then terminate our process.</p>
|
855
|
+
</div></span>
|
856
|
+
|
857
|
+
</li>
|
858
|
+
|
859
|
+
|
860
|
+
<li class="public ">
|
861
|
+
<span class="summary_signature">
|
862
|
+
|
863
|
+
<a href="#run_detached-instance_method" title="#run_detached (instance method)">- (Object) <strong>run_detached</strong> </a>
|
864
|
+
|
865
|
+
|
866
|
+
|
867
|
+
(also: #spin_off)
|
868
|
+
|
869
|
+
</span>
|
870
|
+
|
871
|
+
|
872
|
+
|
873
|
+
|
874
|
+
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
<span class="summary_desc"><div class='inline'>
|
880
|
+
<p>Run the command in the background.</p>
|
881
|
+
</div></span>
|
882
|
+
|
883
|
+
</li>
|
884
|
+
|
885
|
+
|
886
|
+
<li class="public ">
|
887
|
+
<span class="summary_signature">
|
888
|
+
|
889
|
+
<a href="#run_in_background-instance_method" title="#run_in_background (instance method)">- (Object) <strong>run_in_background</strong> </a>
|
890
|
+
|
891
|
+
|
892
|
+
|
893
|
+
(also: #background)
|
894
|
+
|
895
|
+
</span>
|
896
|
+
|
897
|
+
|
898
|
+
|
899
|
+
|
900
|
+
|
901
|
+
|
902
|
+
|
903
|
+
|
904
|
+
|
905
|
+
<span class="summary_desc"><div class='inline'>
|
906
|
+
<p>Run the command in parallel with the parent process - will kill it if it
|
907
|
+
outlasts us.</p>
|
908
|
+
</div></span>
|
909
|
+
|
910
|
+
</li>
|
911
|
+
|
912
|
+
|
913
|
+
<li class="public ">
|
914
|
+
<span class="summary_signature">
|
915
|
+
|
916
|
+
<a href="#set_env-instance_method" title="#set_env (instance method)">- (Object) <strong>set_env</strong>(name, value) </a>
|
917
|
+
|
918
|
+
|
919
|
+
|
920
|
+
</span>
|
921
|
+
|
922
|
+
|
923
|
+
|
924
|
+
|
925
|
+
|
926
|
+
|
927
|
+
|
928
|
+
|
929
|
+
|
930
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
931
|
+
|
932
|
+
</li>
|
933
|
+
|
934
|
+
|
935
|
+
<li class="public ">
|
936
|
+
<span class="summary_signature">
|
937
|
+
|
938
|
+
<a href="#spawn_process-instance_method" title="#spawn_process (instance method)">- (Object) <strong>spawn_process</strong> </a>
|
939
|
+
|
940
|
+
|
941
|
+
|
942
|
+
</span>
|
943
|
+
|
944
|
+
|
945
|
+
|
946
|
+
|
947
|
+
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
|
952
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
953
|
+
|
954
|
+
</li>
|
955
|
+
|
956
|
+
|
957
|
+
<li class="public ">
|
958
|
+
<span class="summary_signature">
|
959
|
+
|
960
|
+
<a href="#string_format-instance_method" title="#string_format (instance method)">- (Object) <strong>string_format</strong> </a>
|
961
|
+
|
962
|
+
|
963
|
+
|
964
|
+
</span>
|
965
|
+
|
966
|
+
|
967
|
+
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
|
972
|
+
|
973
|
+
|
974
|
+
<span class="summary_desc"><div class='inline'>
|
975
|
+
<p>The command as a string, including arguments and options, plus prefixed
|
976
|
+
environment variables.</p>
|
977
|
+
</div></span>
|
978
|
+
|
979
|
+
</li>
|
980
|
+
|
981
|
+
|
982
|
+
<li class="public ">
|
983
|
+
<span class="summary_signature">
|
984
|
+
|
985
|
+
<a href="#succeeds%3F-instance_method" title="#succeeds? (instance method)">- (Boolean) <strong>succeeds?</strong> </a>
|
986
|
+
|
987
|
+
|
988
|
+
|
989
|
+
</span>
|
990
|
+
|
991
|
+
|
992
|
+
|
993
|
+
|
994
|
+
|
995
|
+
|
996
|
+
|
997
|
+
|
998
|
+
|
999
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
1000
|
+
|
1001
|
+
</li>
|
1002
|
+
|
1003
|
+
|
1004
|
+
<li class="public ">
|
1005
|
+
<span class="summary_signature">
|
1006
|
+
|
1007
|
+
<a href="#verbose-instance_method" title="#verbose (instance method)">- (Object) <strong>verbose</strong> </a>
|
1008
|
+
|
1009
|
+
|
1010
|
+
|
1011
|
+
</span>
|
1012
|
+
|
1013
|
+
|
1014
|
+
|
1015
|
+
|
1016
|
+
|
1017
|
+
|
1018
|
+
|
1019
|
+
|
1020
|
+
|
1021
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
1022
|
+
|
1023
|
+
</li>
|
1024
|
+
|
1025
|
+
|
1026
|
+
</ul>
|
1027
|
+
|
1028
|
+
|
1029
|
+
|
1030
|
+
|
1031
|
+
|
1032
|
+
|
1033
|
+
|
1034
|
+
|
1035
|
+
|
1036
|
+
|
1037
|
+
|
1038
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="DefineOp.html" title="Caliph::DefineOp (module)">DefineOp</a></span></h3>
|
1039
|
+
<p class="inherited"><span class='object_link'><a href="DefineOp.html#included-class_method" title="Caliph::DefineOp.included (method)">included</a></span></p>
|
1040
|
+
<div id="constructor_details" class="method_details_list">
|
1041
|
+
<h2>Constructor Details</h2>
|
1042
|
+
|
1043
|
+
<div class="method_details first">
|
1044
|
+
<h3 class="signature first" id="initialize-instance_method">
|
1045
|
+
|
1046
|
+
- (<tt><span class='object_link'><a href="" title="Caliph::CommandLine (class)">CommandLine</a></span></tt>) <strong>initialize</strong>(executable, *options) {|_self| ... }
|
1047
|
+
|
1048
|
+
|
1049
|
+
|
1050
|
+
|
1051
|
+
|
1052
|
+
</h3><div class="docstring">
|
1053
|
+
<div class="discussion">
|
1054
|
+
|
1055
|
+
<p>Returns a new instance of CommandLine</p>
|
1056
|
+
|
1057
|
+
|
1058
|
+
</div>
|
1059
|
+
</div>
|
1060
|
+
<div class="tags">
|
1061
|
+
|
1062
|
+
<p class="tag_title">Yields:</p>
|
1063
|
+
<ul class="yield">
|
1064
|
+
|
1065
|
+
<li>
|
1066
|
+
|
1067
|
+
|
1068
|
+
<span class='type'>(<tt>_self</tt>)</span>
|
1069
|
+
|
1070
|
+
|
1071
|
+
|
1072
|
+
</li>
|
1073
|
+
|
1074
|
+
</ul>
|
1075
|
+
<p class="tag_title">Yield Parameters:</p>
|
1076
|
+
<ul class="yieldparam">
|
1077
|
+
|
1078
|
+
<li>
|
1079
|
+
|
1080
|
+
<span class='name'>_self</span>
|
1081
|
+
|
1082
|
+
|
1083
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Caliph::CommandLine (class)">Caliph::CommandLine</a></span></tt>)</span>
|
1084
|
+
|
1085
|
+
|
1086
|
+
|
1087
|
+
—
|
1088
|
+
<div class='inline'>
|
1089
|
+
<p>the object that the method was called on</p>
|
1090
|
+
</div>
|
1091
|
+
|
1092
|
+
</li>
|
1093
|
+
|
1094
|
+
</ul>
|
1095
|
+
|
1096
|
+
</div><table class="source_code">
|
1097
|
+
<tr>
|
1098
|
+
<td>
|
1099
|
+
<pre class="lines">
|
1100
|
+
|
1101
|
+
|
1102
|
+
12
|
1103
|
+
13
|
1104
|
+
14
|
1105
|
+
15
|
1106
|
+
16
|
1107
|
+
17
|
1108
|
+
18
|
1109
|
+
19</pre>
|
1110
|
+
</td>
|
1111
|
+
<td>
|
1112
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 12</span>
|
1113
|
+
|
1114
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_executable'>executable</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1115
|
+
<span class='ivar'>@output_stream</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_output_stream'>output_stream</span> <span class='op'>||</span> <span class='gvar'>$stderr</span>
|
1116
|
+
<span class='ivar'>@executable</span> <span class='op'>=</span> <span class='id identifier rubyid_executable'>executable</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
1117
|
+
<span class='ivar'>@options</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span>
|
1118
|
+
<span class='ivar'>@redirections</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1119
|
+
<span class='ivar'>@env</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1120
|
+
<span class='kw'>yield</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
1121
|
+
<span class='kw'>end</span></pre>
|
1122
|
+
</td>
|
1123
|
+
</tr>
|
1124
|
+
</table>
|
1125
|
+
</div>
|
1126
|
+
|
1127
|
+
</div>
|
1128
|
+
|
1129
|
+
<div id="class_attr_details" class="attr_details">
|
1130
|
+
<h2>Class Attribute Details</h2>
|
1131
|
+
|
1132
|
+
|
1133
|
+
<span id="command_recording_path=-class_method"></span>
|
1134
|
+
<div class="method_details first">
|
1135
|
+
<h3 class="signature first" id="command_recording_path-class_method">
|
1136
|
+
|
1137
|
+
+ (<tt>Object</tt>) <strong>command_recording_path</strong>
|
1138
|
+
|
1139
|
+
|
1140
|
+
|
1141
|
+
|
1142
|
+
|
1143
|
+
</h3><div class="docstring">
|
1144
|
+
<div class="discussion">
|
1145
|
+
|
1146
|
+
<p>Returns the value of attribute command_recording_path</p>
|
1147
|
+
|
1148
|
+
|
1149
|
+
</div>
|
1150
|
+
</div>
|
1151
|
+
<div class="tags">
|
1152
|
+
|
1153
|
+
|
1154
|
+
</div><table class="source_code">
|
1155
|
+
<tr>
|
1156
|
+
<td>
|
1157
|
+
<pre class="lines">
|
1158
|
+
|
1159
|
+
|
1160
|
+
15
|
1161
|
+
16
|
1162
|
+
17</pre>
|
1163
|
+
</td>
|
1164
|
+
<td>
|
1165
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/testing/record-commands.rb', line 15</span>
|
1166
|
+
|
1167
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_command_recording_path'>command_recording_path</span>
|
1168
|
+
<span class='ivar'>@command_recording_path</span>
|
1169
|
+
<span class='kw'>end</span></pre>
|
1170
|
+
</td>
|
1171
|
+
</tr>
|
1172
|
+
</table>
|
1173
|
+
</div>
|
1174
|
+
|
1175
|
+
|
1176
|
+
<span id="output_stream=-class_method"></span>
|
1177
|
+
<div class="method_details ">
|
1178
|
+
<h3 class="signature " id="output_stream-class_method">
|
1179
|
+
|
1180
|
+
+ (<tt>Object</tt>) <strong>output_stream</strong>
|
1181
|
+
|
1182
|
+
|
1183
|
+
|
1184
|
+
|
1185
|
+
|
1186
|
+
</h3><div class="docstring">
|
1187
|
+
<div class="discussion">
|
1188
|
+
|
1189
|
+
<p>Returns the value of attribute output_stream</p>
|
1190
|
+
|
1191
|
+
|
1192
|
+
</div>
|
1193
|
+
</div>
|
1194
|
+
<div class="tags">
|
1195
|
+
|
1196
|
+
|
1197
|
+
</div><table class="source_code">
|
1198
|
+
<tr>
|
1199
|
+
<td>
|
1200
|
+
<pre class="lines">
|
1201
|
+
|
1202
|
+
|
1203
|
+
9
|
1204
|
+
10
|
1205
|
+
11</pre>
|
1206
|
+
</td>
|
1207
|
+
<td>
|
1208
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 9</span>
|
1209
|
+
|
1210
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_output_stream'>output_stream</span>
|
1211
|
+
<span class='ivar'>@output_stream</span>
|
1212
|
+
<span class='kw'>end</span></pre>
|
1213
|
+
</td>
|
1214
|
+
</tr>
|
1215
|
+
</table>
|
1216
|
+
</div>
|
1217
|
+
|
1218
|
+
</div>
|
1219
|
+
|
1220
|
+
<div id="instance_attr_details" class="attr_details">
|
1221
|
+
<h2>Instance Attribute Details</h2>
|
1222
|
+
|
1223
|
+
|
1224
|
+
<span id="env=-instance_method"></span>
|
1225
|
+
<div class="method_details first">
|
1226
|
+
<h3 class="signature first" id="env-instance_method">
|
1227
|
+
|
1228
|
+
- (<tt>Object</tt>) <strong>env</strong>
|
1229
|
+
|
1230
|
+
|
1231
|
+
|
1232
|
+
<span class="aliases">Also known as:
|
1233
|
+
<span class="names"><span id='command_environment-instance_method'>command_environment</span></span>
|
1234
|
+
</span>
|
1235
|
+
|
1236
|
+
|
1237
|
+
|
1238
|
+
</h3><div class="docstring">
|
1239
|
+
<div class="discussion">
|
1240
|
+
|
1241
|
+
<p>Returns the value of attribute env</p>
|
1242
|
+
|
1243
|
+
|
1244
|
+
</div>
|
1245
|
+
</div>
|
1246
|
+
<div class="tags">
|
1247
|
+
|
1248
|
+
|
1249
|
+
</div><table class="source_code">
|
1250
|
+
<tr>
|
1251
|
+
<td>
|
1252
|
+
<pre class="lines">
|
1253
|
+
|
1254
|
+
|
1255
|
+
21
|
1256
|
+
22
|
1257
|
+
23</pre>
|
1258
|
+
</td>
|
1259
|
+
<td>
|
1260
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 21</span>
|
1261
|
+
|
1262
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_env'>env</span>
|
1263
|
+
<span class='ivar'>@env</span>
|
1264
|
+
<span class='kw'>end</span></pre>
|
1265
|
+
</td>
|
1266
|
+
</tr>
|
1267
|
+
</table>
|
1268
|
+
</div>
|
1269
|
+
|
1270
|
+
|
1271
|
+
<span id="executable=-instance_method"></span>
|
1272
|
+
<div class="method_details ">
|
1273
|
+
<h3 class="signature " id="executable-instance_method">
|
1274
|
+
|
1275
|
+
- (<tt>Object</tt>) <strong>executable</strong>
|
1276
|
+
|
1277
|
+
|
1278
|
+
|
1279
|
+
|
1280
|
+
|
1281
|
+
</h3><div class="docstring">
|
1282
|
+
<div class="discussion">
|
1283
|
+
|
1284
|
+
<p>Returns the value of attribute executable</p>
|
1285
|
+
|
1286
|
+
|
1287
|
+
</div>
|
1288
|
+
</div>
|
1289
|
+
<div class="tags">
|
1290
|
+
|
1291
|
+
|
1292
|
+
</div><table class="source_code">
|
1293
|
+
<tr>
|
1294
|
+
<td>
|
1295
|
+
<pre class="lines">
|
1296
|
+
|
1297
|
+
|
1298
|
+
21
|
1299
|
+
22
|
1300
|
+
23</pre>
|
1301
|
+
</td>
|
1302
|
+
<td>
|
1303
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 21</span>
|
1304
|
+
|
1305
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_executable'>executable</span>
|
1306
|
+
<span class='ivar'>@executable</span>
|
1307
|
+
<span class='kw'>end</span></pre>
|
1308
|
+
</td>
|
1309
|
+
</tr>
|
1310
|
+
</table>
|
1311
|
+
</div>
|
1312
|
+
|
1313
|
+
|
1314
|
+
<span id="name=-instance_method"></span>
|
1315
|
+
<div class="method_details ">
|
1316
|
+
<h3 class="signature " id="name-instance_method">
|
1317
|
+
|
1318
|
+
- (<tt>Object</tt>) <strong>name</strong>
|
1319
|
+
|
1320
|
+
|
1321
|
+
|
1322
|
+
|
1323
|
+
|
1324
|
+
</h3><div class="docstring">
|
1325
|
+
<div class="discussion">
|
1326
|
+
|
1327
|
+
<p>Returns the value of attribute name</p>
|
1328
|
+
|
1329
|
+
|
1330
|
+
</div>
|
1331
|
+
</div>
|
1332
|
+
<div class="tags">
|
1333
|
+
|
1334
|
+
|
1335
|
+
</div><table class="source_code">
|
1336
|
+
<tr>
|
1337
|
+
<td>
|
1338
|
+
<pre class="lines">
|
1339
|
+
|
1340
|
+
|
1341
|
+
21
|
1342
|
+
22
|
1343
|
+
23</pre>
|
1344
|
+
</td>
|
1345
|
+
<td>
|
1346
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 21</span>
|
1347
|
+
|
1348
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
1349
|
+
<span class='ivar'>@name</span>
|
1350
|
+
<span class='kw'>end</span></pre>
|
1351
|
+
</td>
|
1352
|
+
</tr>
|
1353
|
+
</table>
|
1354
|
+
</div>
|
1355
|
+
|
1356
|
+
|
1357
|
+
<span id="options=-instance_method"></span>
|
1358
|
+
<div class="method_details ">
|
1359
|
+
<h3 class="signature " id="options-instance_method">
|
1360
|
+
|
1361
|
+
- (<tt>Object</tt>) <strong>options</strong>
|
1362
|
+
|
1363
|
+
|
1364
|
+
|
1365
|
+
|
1366
|
+
|
1367
|
+
</h3><div class="docstring">
|
1368
|
+
<div class="discussion">
|
1369
|
+
|
1370
|
+
<p>Returns the value of attribute options</p>
|
1371
|
+
|
1372
|
+
|
1373
|
+
</div>
|
1374
|
+
</div>
|
1375
|
+
<div class="tags">
|
1376
|
+
|
1377
|
+
|
1378
|
+
</div><table class="source_code">
|
1379
|
+
<tr>
|
1380
|
+
<td>
|
1381
|
+
<pre class="lines">
|
1382
|
+
|
1383
|
+
|
1384
|
+
21
|
1385
|
+
22
|
1386
|
+
23</pre>
|
1387
|
+
</td>
|
1388
|
+
<td>
|
1389
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 21</span>
|
1390
|
+
|
1391
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_options'>options</span>
|
1392
|
+
<span class='ivar'>@options</span>
|
1393
|
+
<span class='kw'>end</span></pre>
|
1394
|
+
</td>
|
1395
|
+
</tr>
|
1396
|
+
</table>
|
1397
|
+
</div>
|
1398
|
+
|
1399
|
+
|
1400
|
+
<span id="output_stream=-instance_method"></span>
|
1401
|
+
<div class="method_details ">
|
1402
|
+
<h3 class="signature " id="output_stream-instance_method">
|
1403
|
+
|
1404
|
+
- (<tt>Object</tt>) <strong>output_stream</strong>
|
1405
|
+
|
1406
|
+
|
1407
|
+
|
1408
|
+
|
1409
|
+
|
1410
|
+
</h3><div class="docstring">
|
1411
|
+
<div class="discussion">
|
1412
|
+
|
1413
|
+
<p>Returns the value of attribute output_stream</p>
|
1414
|
+
|
1415
|
+
|
1416
|
+
</div>
|
1417
|
+
</div>
|
1418
|
+
<div class="tags">
|
1419
|
+
|
1420
|
+
|
1421
|
+
</div><table class="source_code">
|
1422
|
+
<tr>
|
1423
|
+
<td>
|
1424
|
+
<pre class="lines">
|
1425
|
+
|
1426
|
+
|
1427
|
+
21
|
1428
|
+
22
|
1429
|
+
23</pre>
|
1430
|
+
</td>
|
1431
|
+
<td>
|
1432
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 21</span>
|
1433
|
+
|
1434
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_output_stream'>output_stream</span>
|
1435
|
+
<span class='ivar'>@output_stream</span>
|
1436
|
+
<span class='kw'>end</span></pre>
|
1437
|
+
</td>
|
1438
|
+
</tr>
|
1439
|
+
</table>
|
1440
|
+
</div>
|
1441
|
+
|
1442
|
+
|
1443
|
+
<span id=""></span>
|
1444
|
+
<div class="method_details ">
|
1445
|
+
<h3 class="signature " id="redirections-instance_method">
|
1446
|
+
|
1447
|
+
- (<tt>Object</tt>) <strong>redirections</strong> <span class="extras">(readonly)</span>
|
1448
|
+
|
1449
|
+
|
1450
|
+
|
1451
|
+
|
1452
|
+
|
1453
|
+
</h3><div class="docstring">
|
1454
|
+
<div class="discussion">
|
1455
|
+
|
1456
|
+
<p>Returns the value of attribute redirections</p>
|
1457
|
+
|
1458
|
+
|
1459
|
+
</div>
|
1460
|
+
</div>
|
1461
|
+
<div class="tags">
|
1462
|
+
|
1463
|
+
|
1464
|
+
</div><table class="source_code">
|
1465
|
+
<tr>
|
1466
|
+
<td>
|
1467
|
+
<pre class="lines">
|
1468
|
+
|
1469
|
+
|
1470
|
+
22
|
1471
|
+
23
|
1472
|
+
24</pre>
|
1473
|
+
</td>
|
1474
|
+
<td>
|
1475
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 22</span>
|
1476
|
+
|
1477
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirections'>redirections</span>
|
1478
|
+
<span class='ivar'>@redirections</span>
|
1479
|
+
<span class='kw'>end</span></pre>
|
1480
|
+
</td>
|
1481
|
+
</tr>
|
1482
|
+
</table>
|
1483
|
+
</div>
|
1484
|
+
|
1485
|
+
</div>
|
1486
|
+
|
1487
|
+
|
1488
|
+
<div id="class_method_details" class="method_details_list">
|
1489
|
+
<h2>Class Method Details</h2>
|
1490
|
+
|
1491
|
+
|
1492
|
+
<div class="method_details first">
|
1493
|
+
<h3 class="signature first" id="emit_recording-class_method">
|
1494
|
+
|
1495
|
+
+ (<tt>Object</tt>) <strong>emit_recording</strong>
|
1496
|
+
|
1497
|
+
|
1498
|
+
|
1499
|
+
|
1500
|
+
|
1501
|
+
</h3><table class="source_code">
|
1502
|
+
<tr>
|
1503
|
+
<td>
|
1504
|
+
<pre class="lines">
|
1505
|
+
|
1506
|
+
|
1507
|
+
21
|
1508
|
+
22
|
1509
|
+
23
|
1510
|
+
24
|
1511
|
+
25
|
1512
|
+
26
|
1513
|
+
27
|
1514
|
+
28
|
1515
|
+
29
|
1516
|
+
30
|
1517
|
+
31</pre>
|
1518
|
+
</td>
|
1519
|
+
<td>
|
1520
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/testing/record-commands.rb', line 21</span>
|
1521
|
+
|
1522
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_emit_recording'>emit_recording</span>
|
1523
|
+
<span class='id identifier rubyid_io'>io</span> <span class='op'>=</span> <span class='gvar'>$stderr</span>
|
1524
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_command_recording_path'>command_recording_path</span>
|
1525
|
+
<span class='id identifier rubyid_io'>io</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_command_recording_path'>command_recording_path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>w</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1526
|
+
<span class='kw'>else</span>
|
1527
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Set CALIPH_CMDREC to write to a path</span><span class='tstring_end'>"</span></span>
|
1528
|
+
<span class='kw'>end</span>
|
1529
|
+
<span class='cvar'>@@commands</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_pair'>pair</span><span class='op'>|</span>
|
1530
|
+
<span class='id identifier rubyid_io'>io</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_pair'>pair</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='tstring_content'>/, </span><span class='embexpr_beg'>#{</span><span class='lbracket'>[</span><span class='id identifier rubyid_pair'>pair</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_exit_code'>exit_code</span><span class='comma'>,</span> <span class='id identifier rubyid_pair'>pair</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_streams'>streams</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>]</span><span class='tstring_end'>"</span></span>
|
1531
|
+
<span class='kw'>end</span>
|
1532
|
+
<span class='kw'>end</span></pre>
|
1533
|
+
</td>
|
1534
|
+
</tr>
|
1535
|
+
</table>
|
1536
|
+
</div>
|
1537
|
+
|
1538
|
+
<div class="method_details ">
|
1539
|
+
<h3 class="signature " id="execute-class_method">
|
1540
|
+
|
1541
|
+
+ (<tt>Object</tt>) <strong>execute</strong>(*args)
|
1542
|
+
|
1543
|
+
|
1544
|
+
|
1545
|
+
|
1546
|
+
|
1547
|
+
</h3><table class="source_code">
|
1548
|
+
<tr>
|
1549
|
+
<td>
|
1550
|
+
<pre class="lines">
|
1551
|
+
|
1552
|
+
|
1553
|
+
28
|
1554
|
+
29
|
1555
|
+
30</pre>
|
1556
|
+
</td>
|
1557
|
+
<td>
|
1558
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/testing/mock-command-line.rb', line 28</span>
|
1559
|
+
|
1560
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
1561
|
+
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Command line executed in specs without 'expect_command' or 'expect_some_commands'</span><span class='tstring_end'>"</span></span>
|
1562
|
+
<span class='kw'>end</span></pre>
|
1563
|
+
</td>
|
1564
|
+
</tr>
|
1565
|
+
</table>
|
1566
|
+
</div>
|
1567
|
+
|
1568
|
+
</div>
|
1569
|
+
|
1570
|
+
<div id="instance_method_details" class="method_details_list">
|
1571
|
+
<h2>Instance Method Details</h2>
|
1572
|
+
|
1573
|
+
|
1574
|
+
<div class="method_details first">
|
1575
|
+
<h3 class="signature first" id="collect_result-instance_method">
|
1576
|
+
|
1577
|
+
- (<tt>Object</tt>) <strong>collect_result</strong>(pid, host_stdout, host_stderr)
|
1578
|
+
|
1579
|
+
|
1580
|
+
|
1581
|
+
|
1582
|
+
|
1583
|
+
</h3><div class="docstring">
|
1584
|
+
<div class="discussion">
|
1585
|
+
|
1586
|
+
<p>Given a process ID for a running command and a pair of stdout/stdin
|
1587
|
+
streams, records the results of the command and returns them in a
|
1588
|
+
CommandRunResult instance.</p>
|
1589
|
+
|
1590
|
+
|
1591
|
+
</div>
|
1592
|
+
</div>
|
1593
|
+
<div class="tags">
|
1594
|
+
|
1595
|
+
|
1596
|
+
</div><table class="source_code">
|
1597
|
+
<tr>
|
1598
|
+
<td>
|
1599
|
+
<pre class="lines">
|
1600
|
+
|
1601
|
+
|
1602
|
+
140
|
1603
|
+
141
|
1604
|
+
142
|
1605
|
+
143
|
1606
|
+
144
|
1607
|
+
145</pre>
|
1608
|
+
</td>
|
1609
|
+
<td>
|
1610
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 140</span>
|
1611
|
+
|
1612
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collect_result'>collect_result</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_host_stdout'>host_stdout</span><span class='comma'>,</span> <span class='id identifier rubyid_host_stderr'>host_stderr</span><span class='rparen'>)</span>
|
1613
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='const'>CommandRunResult</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='kw'>self</span><span class='rparen'>)</span>
|
1614
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_streams'>streams</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='int'>1</span> <span class='op'>=></span> <span class='id identifier rubyid_host_stdout'>host_stdout</span><span class='comma'>,</span> <span class='int'>2</span> <span class='op'>=></span> <span class='id identifier rubyid_host_stderr'>host_stderr</span><span class='rbrace'>}</span>
|
1615
|
+
<span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_wait'>wait</span>
|
1616
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_result'>result</span>
|
1617
|
+
<span class='kw'>end</span></pre>
|
1618
|
+
</td>
|
1619
|
+
</tr>
|
1620
|
+
</table>
|
1621
|
+
</div>
|
1622
|
+
|
1623
|
+
<div class="method_details ">
|
1624
|
+
<h3 class="signature " id="command-instance_method">
|
1625
|
+
|
1626
|
+
- (<tt>Object</tt>) <strong>command</strong>
|
1627
|
+
|
1628
|
+
|
1629
|
+
|
1630
|
+
|
1631
|
+
|
1632
|
+
</h3><div class="docstring">
|
1633
|
+
<div class="discussion">
|
1634
|
+
|
1635
|
+
<p>The command as a string, including arguments and options</p>
|
1636
|
+
|
1637
|
+
|
1638
|
+
</div>
|
1639
|
+
</div>
|
1640
|
+
<div class="tags">
|
1641
|
+
|
1642
|
+
|
1643
|
+
</div><table class="source_code">
|
1644
|
+
<tr>
|
1645
|
+
<td>
|
1646
|
+
<pre class="lines">
|
1647
|
+
|
1648
|
+
|
1649
|
+
40
|
1650
|
+
41
|
1651
|
+
42</pre>
|
1652
|
+
</td>
|
1653
|
+
<td>
|
1654
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 40</span>
|
1655
|
+
|
1656
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_command'>command</span>
|
1657
|
+
<span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_executable'>executable</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='id identifier rubyid_options_composition'>options_composition</span> <span class='op'>+</span> <span class='ivar'>@redirections</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1658
|
+
<span class='kw'>end</span></pre>
|
1659
|
+
</td>
|
1660
|
+
</tr>
|
1661
|
+
</table>
|
1662
|
+
</div>
|
1663
|
+
|
1664
|
+
<div class="method_details ">
|
1665
|
+
<h3 class="signature " id="complete-instance_method">
|
1666
|
+
|
1667
|
+
- (<tt>Object</tt>) <strong>complete</strong>(pid, out, err)
|
1668
|
+
|
1669
|
+
|
1670
|
+
|
1671
|
+
|
1672
|
+
|
1673
|
+
</h3><table class="source_code">
|
1674
|
+
<tr>
|
1675
|
+
<td>
|
1676
|
+
<pre class="lines">
|
1677
|
+
|
1678
|
+
|
1679
|
+
152
|
1680
|
+
153
|
1681
|
+
154
|
1682
|
+
155</pre>
|
1683
|
+
</td>
|
1684
|
+
<td>
|
1685
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 152</span>
|
1686
|
+
|
1687
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_complete'>complete</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_out'>out</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span><span class='rparen'>)</span>
|
1688
|
+
<span class='id identifier rubyid_kill_process'>kill_process</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
|
1689
|
+
<span class='id identifier rubyid_collect_result'>collect_result</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_out'>out</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span><span class='rparen'>)</span>
|
1690
|
+
<span class='kw'>end</span></pre>
|
1691
|
+
</td>
|
1692
|
+
</tr>
|
1693
|
+
</table>
|
1694
|
+
</div>
|
1695
|
+
|
1696
|
+
<div class="method_details ">
|
1697
|
+
<h3 class="signature " id="copy_stream_to-instance_method">
|
1698
|
+
|
1699
|
+
- (<tt>Object</tt>) <strong>copy_stream_to</strong>(from, to)
|
1700
|
+
|
1701
|
+
|
1702
|
+
|
1703
|
+
|
1704
|
+
|
1705
|
+
</h3><table class="source_code">
|
1706
|
+
<tr>
|
1707
|
+
<td>
|
1708
|
+
<pre class="lines">
|
1709
|
+
|
1710
|
+
|
1711
|
+
65
|
1712
|
+
66
|
1713
|
+
67</pre>
|
1714
|
+
</td>
|
1715
|
+
<td>
|
1716
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 65</span>
|
1717
|
+
|
1718
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_copy_stream_to'>copy_stream_to</span><span class='lparen'>(</span><span class='id identifier rubyid_from'>from</span><span class='comma'>,</span> <span class='id identifier rubyid_to'>to</span><span class='rparen'>)</span>
|
1719
|
+
<span class='ivar'>@redirections</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_from'>from</span><span class='embexpr_end'>}</span><span class='tstring_content'>>&</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_to'>to</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1720
|
+
<span class='kw'>end</span></pre>
|
1721
|
+
</td>
|
1722
|
+
</tr>
|
1723
|
+
</table>
|
1724
|
+
</div>
|
1725
|
+
|
1726
|
+
<div class="method_details ">
|
1727
|
+
<h3 class="signature " id="execute-instance_method">
|
1728
|
+
|
1729
|
+
- (<tt>Object</tt>) <strong>execute</strong>
|
1730
|
+
|
1731
|
+
|
1732
|
+
|
1733
|
+
|
1734
|
+
|
1735
|
+
</h3><div class="docstring">
|
1736
|
+
<div class="discussion">
|
1737
|
+
|
1738
|
+
<p>Run the command, wait for termination, and collect the results. Returns an
|
1739
|
+
instance of CommandRunResult that contains the output and exit code of the
|
1740
|
+
command.</p>
|
1741
|
+
|
1742
|
+
|
1743
|
+
</div>
|
1744
|
+
</div>
|
1745
|
+
<div class="tags">
|
1746
|
+
|
1747
|
+
|
1748
|
+
</div><table class="source_code">
|
1749
|
+
<tr>
|
1750
|
+
<td>
|
1751
|
+
<pre class="lines">
|
1752
|
+
|
1753
|
+
|
1754
|
+
121
|
1755
|
+
122
|
1756
|
+
123</pre>
|
1757
|
+
</td>
|
1758
|
+
<td>
|
1759
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 121</span>
|
1760
|
+
|
1761
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span>
|
1762
|
+
<span class='id identifier rubyid_collect_result'>collect_result</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_spawn_process'>spawn_process</span><span class='rparen'>)</span>
|
1763
|
+
<span class='kw'>end</span></pre>
|
1764
|
+
</td>
|
1765
|
+
</tr>
|
1766
|
+
</table>
|
1767
|
+
</div>
|
1768
|
+
|
1769
|
+
<div class="method_details ">
|
1770
|
+
<h3 class="signature " id="kill_process-instance_method">
|
1771
|
+
|
1772
|
+
- (<tt>Object</tt>) <strong>kill_process</strong>(pid)
|
1773
|
+
|
1774
|
+
|
1775
|
+
|
1776
|
+
|
1777
|
+
|
1778
|
+
</h3><table class="source_code">
|
1779
|
+
<tr>
|
1780
|
+
<td>
|
1781
|
+
<pre class="lines">
|
1782
|
+
|
1783
|
+
|
1784
|
+
148
|
1785
|
+
149
|
1786
|
+
150</pre>
|
1787
|
+
</td>
|
1788
|
+
<td>
|
1789
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 148</span>
|
1790
|
+
|
1791
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_kill_process'>kill_process</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
|
1792
|
+
<span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>INT</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
|
1793
|
+
<span class='kw'>end</span></pre>
|
1794
|
+
</td>
|
1795
|
+
</tr>
|
1796
|
+
</table>
|
1797
|
+
</div>
|
1798
|
+
|
1799
|
+
<div class="method_details ">
|
1800
|
+
<h3 class="signature " id="must_succeed!-instance_method">
|
1801
|
+
|
1802
|
+
- (<tt>Object</tt>) <strong>must_succeed!</strong>
|
1803
|
+
|
1804
|
+
|
1805
|
+
|
1806
|
+
|
1807
|
+
|
1808
|
+
</h3><table class="source_code">
|
1809
|
+
<tr>
|
1810
|
+
<td>
|
1811
|
+
<pre class="lines">
|
1812
|
+
|
1813
|
+
|
1814
|
+
166
|
1815
|
+
167
|
1816
|
+
168</pre>
|
1817
|
+
</td>
|
1818
|
+
<td>
|
1819
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 166</span>
|
1820
|
+
|
1821
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_must_succeed!'>must_succeed!</span>
|
1822
|
+
<span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_must_succeed!'>must_succeed!</span>
|
1823
|
+
<span class='kw'>end</span></pre>
|
1824
|
+
</td>
|
1825
|
+
</tr>
|
1826
|
+
</table>
|
1827
|
+
</div>
|
1828
|
+
|
1829
|
+
<div class="method_details ">
|
1830
|
+
<h3 class="signature " id="options_composition-instance_method">
|
1831
|
+
|
1832
|
+
- (<tt>Object</tt>) <strong>options_composition</strong>
|
1833
|
+
|
1834
|
+
|
1835
|
+
|
1836
|
+
|
1837
|
+
|
1838
|
+
</h3><table class="source_code">
|
1839
|
+
<tr>
|
1840
|
+
<td>
|
1841
|
+
<pre class="lines">
|
1842
|
+
|
1843
|
+
|
1844
|
+
52
|
1845
|
+
53
|
1846
|
+
54</pre>
|
1847
|
+
</td>
|
1848
|
+
<td>
|
1849
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 52</span>
|
1850
|
+
|
1851
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_options_composition'>options_composition</span>
|
1852
|
+
<span class='id identifier rubyid_options'>options</span>
|
1853
|
+
<span class='kw'>end</span></pre>
|
1854
|
+
</td>
|
1855
|
+
</tr>
|
1856
|
+
</table>
|
1857
|
+
</div>
|
1858
|
+
|
1859
|
+
<div class="method_details ">
|
1860
|
+
<h3 class="signature " id="original_execute-instance_method">
|
1861
|
+
|
1862
|
+
- (<tt>Object</tt>) <strong>original_execute</strong>
|
1863
|
+
|
1864
|
+
|
1865
|
+
|
1866
|
+
|
1867
|
+
|
1868
|
+
</h3><div class="docstring">
|
1869
|
+
<div class="discussion">
|
1870
|
+
|
1871
|
+
<p>Run the command, wait for termination, and collect the results. Returns an
|
1872
|
+
instance of CommandRunResult that contains the output and exit code of the
|
1873
|
+
command.</p>
|
1874
|
+
|
1875
|
+
|
1876
|
+
</div>
|
1877
|
+
</div>
|
1878
|
+
<div class="tags">
|
1879
|
+
|
1880
|
+
|
1881
|
+
</div><table class="source_code">
|
1882
|
+
<tr>
|
1883
|
+
<td>
|
1884
|
+
<pre class="lines">
|
1885
|
+
|
1886
|
+
|
1887
|
+
6
|
1888
|
+
7
|
1889
|
+
8</pre>
|
1890
|
+
</td>
|
1891
|
+
<td>
|
1892
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/testing/record-commands.rb', line 6</span>
|
1893
|
+
|
1894
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span>
|
1895
|
+
<span class='id identifier rubyid_collect_result'>collect_result</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_spawn_process'>spawn_process</span><span class='rparen'>)</span>
|
1896
|
+
<span class='kw'>end</span></pre>
|
1897
|
+
</td>
|
1898
|
+
</tr>
|
1899
|
+
</table>
|
1900
|
+
</div>
|
1901
|
+
|
1902
|
+
<div class="method_details ">
|
1903
|
+
<h3 class="signature " id="redirect_both-instance_method">
|
1904
|
+
|
1905
|
+
- (<tt>Object</tt>) <strong>redirect_both</strong>(path)
|
1906
|
+
|
1907
|
+
|
1908
|
+
|
1909
|
+
|
1910
|
+
|
1911
|
+
</h3><table class="source_code">
|
1912
|
+
<tr>
|
1913
|
+
<td>
|
1914
|
+
<pre class="lines">
|
1915
|
+
|
1916
|
+
|
1917
|
+
81
|
1918
|
+
82
|
1919
|
+
83</pre>
|
1920
|
+
</td>
|
1921
|
+
<td>
|
1922
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 81</span>
|
1923
|
+
|
1924
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirect_both'>redirect_both</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1925
|
+
<span class='id identifier rubyid_redirect_stdout'>redirect_stdout</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_redirect_stderr'>redirect_stderr</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1926
|
+
<span class='kw'>end</span></pre>
|
1927
|
+
</td>
|
1928
|
+
</tr>
|
1929
|
+
</table>
|
1930
|
+
</div>
|
1931
|
+
|
1932
|
+
<div class="method_details ">
|
1933
|
+
<h3 class="signature " id="redirect_from-instance_method">
|
1934
|
+
|
1935
|
+
- (<tt>Object</tt>) <strong>redirect_from</strong>(path, stream)
|
1936
|
+
|
1937
|
+
|
1938
|
+
|
1939
|
+
|
1940
|
+
|
1941
|
+
</h3><table class="source_code">
|
1942
|
+
<tr>
|
1943
|
+
<td>
|
1944
|
+
<pre class="lines">
|
1945
|
+
|
1946
|
+
|
1947
|
+
61
|
1948
|
+
62
|
1949
|
+
63</pre>
|
1950
|
+
</td>
|
1951
|
+
<td>
|
1952
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 61</span>
|
1953
|
+
|
1954
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirect_from'>redirect_from</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_stream'>stream</span><span class='rparen'>)</span>
|
1955
|
+
<span class='ivar'>@redirections</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_stream'>stream</span><span class='embexpr_end'>}</span><span class='tstring_content'><</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1956
|
+
<span class='kw'>end</span></pre>
|
1957
|
+
</td>
|
1958
|
+
</tr>
|
1959
|
+
</table>
|
1960
|
+
</div>
|
1961
|
+
|
1962
|
+
<div class="method_details ">
|
1963
|
+
<h3 class="signature " id="redirect_stderr-instance_method">
|
1964
|
+
|
1965
|
+
- (<tt>Object</tt>) <strong>redirect_stderr</strong>(path)
|
1966
|
+
|
1967
|
+
|
1968
|
+
|
1969
|
+
|
1970
|
+
|
1971
|
+
</h3><table class="source_code">
|
1972
|
+
<tr>
|
1973
|
+
<td>
|
1974
|
+
<pre class="lines">
|
1975
|
+
|
1976
|
+
|
1977
|
+
73
|
1978
|
+
74
|
1979
|
+
75</pre>
|
1980
|
+
</td>
|
1981
|
+
<td>
|
1982
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 73</span>
|
1983
|
+
|
1984
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirect_stderr'>redirect_stderr</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1985
|
+
<span class='id identifier rubyid_redirect_to'>redirect_to</span><span class='lparen'>(</span><span class='int'>2</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1986
|
+
<span class='kw'>end</span></pre>
|
1987
|
+
</td>
|
1988
|
+
</tr>
|
1989
|
+
</table>
|
1990
|
+
</div>
|
1991
|
+
|
1992
|
+
<div class="method_details ">
|
1993
|
+
<h3 class="signature " id="redirect_stdin-instance_method">
|
1994
|
+
|
1995
|
+
- (<tt>Object</tt>) <strong>redirect_stdin</strong>(path)
|
1996
|
+
|
1997
|
+
|
1998
|
+
|
1999
|
+
|
2000
|
+
|
2001
|
+
</h3><table class="source_code">
|
2002
|
+
<tr>
|
2003
|
+
<td>
|
2004
|
+
<pre class="lines">
|
2005
|
+
|
2006
|
+
|
2007
|
+
77
|
2008
|
+
78
|
2009
|
+
79</pre>
|
2010
|
+
</td>
|
2011
|
+
<td>
|
2012
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 77</span>
|
2013
|
+
|
2014
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirect_stdin'>redirect_stdin</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
2015
|
+
<span class='id identifier rubyid_redirect_from'>redirect_from</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='int'>0</span><span class='rparen'>)</span>
|
2016
|
+
<span class='kw'>end</span></pre>
|
2017
|
+
</td>
|
2018
|
+
</tr>
|
2019
|
+
</table>
|
2020
|
+
</div>
|
2021
|
+
|
2022
|
+
<div class="method_details ">
|
2023
|
+
<h3 class="signature " id="redirect_stdout-instance_method">
|
2024
|
+
|
2025
|
+
- (<tt>Object</tt>) <strong>redirect_stdout</strong>(path)
|
2026
|
+
|
2027
|
+
|
2028
|
+
|
2029
|
+
|
2030
|
+
|
2031
|
+
</h3><table class="source_code">
|
2032
|
+
<tr>
|
2033
|
+
<td>
|
2034
|
+
<pre class="lines">
|
2035
|
+
|
2036
|
+
|
2037
|
+
69
|
2038
|
+
70
|
2039
|
+
71</pre>
|
2040
|
+
</td>
|
2041
|
+
<td>
|
2042
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 69</span>
|
2043
|
+
|
2044
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirect_stdout'>redirect_stdout</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
2045
|
+
<span class='id identifier rubyid_redirect_to'>redirect_to</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
2046
|
+
<span class='kw'>end</span></pre>
|
2047
|
+
</td>
|
2048
|
+
</tr>
|
2049
|
+
</table>
|
2050
|
+
</div>
|
2051
|
+
|
2052
|
+
<div class="method_details ">
|
2053
|
+
<h3 class="signature " id="redirect_to-instance_method">
|
2054
|
+
|
2055
|
+
- (<tt>Object</tt>) <strong>redirect_to</strong>(stream, path)
|
2056
|
+
|
2057
|
+
|
2058
|
+
|
2059
|
+
|
2060
|
+
|
2061
|
+
</h3><table class="source_code">
|
2062
|
+
<tr>
|
2063
|
+
<td>
|
2064
|
+
<pre class="lines">
|
2065
|
+
|
2066
|
+
|
2067
|
+
56
|
2068
|
+
57
|
2069
|
+
58
|
2070
|
+
59</pre>
|
2071
|
+
</td>
|
2072
|
+
<td>
|
2073
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 56</span>
|
2074
|
+
|
2075
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_redirect_to'>redirect_to</span><span class='lparen'>(</span><span class='id identifier rubyid_stream'>stream</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
2076
|
+
<span class='ivar'>@redirections</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_stream'>stream</span><span class='embexpr_end'>}</span><span class='tstring_content'>></span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
2077
|
+
<span class='kw'>self</span>
|
2078
|
+
<span class='kw'>end</span></pre>
|
2079
|
+
</td>
|
2080
|
+
</tr>
|
2081
|
+
</table>
|
2082
|
+
</div>
|
2083
|
+
|
2084
|
+
<div class="method_details ">
|
2085
|
+
<h3 class="signature " id="report-instance_method">
|
2086
|
+
|
2087
|
+
- (<tt>Object</tt>) <strong>report</strong>(message, newline = true)
|
2088
|
+
|
2089
|
+
|
2090
|
+
|
2091
|
+
|
2092
|
+
|
2093
|
+
</h3><table class="source_code">
|
2094
|
+
<tr>
|
2095
|
+
<td>
|
2096
|
+
<pre class="lines">
|
2097
|
+
|
2098
|
+
|
2099
|
+
157
|
2100
|
+
158
|
2101
|
+
159</pre>
|
2102
|
+
</td>
|
2103
|
+
<td>
|
2104
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 157</span>
|
2105
|
+
|
2106
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_report'>report</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_newline'>newline</span><span class='op'>=</span><span class='kw'>true</span><span class='rparen'>)</span>
|
2107
|
+
<span class='id identifier rubyid_output_stream'>output_stream</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_newline'>newline</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2108
|
+
<span class='kw'>end</span></pre>
|
2109
|
+
</td>
|
2110
|
+
</tr>
|
2111
|
+
</table>
|
2112
|
+
</div>
|
2113
|
+
|
2114
|
+
<div class="method_details ">
|
2115
|
+
<h3 class="signature " id="run-instance_method">
|
2116
|
+
|
2117
|
+
- (<tt>Object</tt>) <strong>run</strong>
|
2118
|
+
|
2119
|
+
|
2120
|
+
|
2121
|
+
|
2122
|
+
|
2123
|
+
</h3><div class="docstring">
|
2124
|
+
<div class="discussion">
|
2125
|
+
|
2126
|
+
<p>Run the command, wait for termination, and collect the results. Returns an
|
2127
|
+
instance of CommandRunResult that contains the output and exit code of the
|
2128
|
+
command.</p>
|
2129
|
+
|
2130
|
+
<p>This version adds some information to STDOUT to document that the command
|
2131
|
+
is running. For a terser version, call #execute directly</p>
|
2132
|
+
|
2133
|
+
|
2134
|
+
</div>
|
2135
|
+
</div>
|
2136
|
+
<div class="tags">
|
2137
|
+
|
2138
|
+
|
2139
|
+
</div><table class="source_code">
|
2140
|
+
<tr>
|
2141
|
+
<td>
|
2142
|
+
<pre class="lines">
|
2143
|
+
|
2144
|
+
|
2145
|
+
91
|
2146
|
+
92
|
2147
|
+
93
|
2148
|
+
94
|
2149
|
+
95
|
2150
|
+
96
|
2151
|
+
97
|
2152
|
+
98
|
2153
|
+
99</pre>
|
2154
|
+
</td>
|
2155
|
+
<td>
|
2156
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 91</span>
|
2157
|
+
|
2158
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
|
2159
|
+
<span class='id identifier rubyid_report'>report</span> <span class='id identifier rubyid_string_format'>string_format</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='kw'>false</span>
|
2160
|
+
<span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_execute'>execute</span>
|
2161
|
+
<span class='id identifier rubyid_report'>report</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>=> </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_exit_code'>exit_code</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
2162
|
+
<span class='id identifier rubyid_report'>report</span> <span class='id identifier rubyid_result'>result</span><span class='period'>.</span><span class='id identifier rubyid_format_streams'>format_streams</span> <span class='kw'>if</span> <span class='id identifier rubyid_verbose'>verbose</span>
|
2163
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_result'>result</span>
|
2164
|
+
<span class='kw'>ensure</span>
|
2165
|
+
<span class='id identifier rubyid_report'>report</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_verbose'>verbose</span>
|
2166
|
+
<span class='kw'>end</span></pre>
|
2167
|
+
</td>
|
2168
|
+
</tr>
|
2169
|
+
</table>
|
2170
|
+
</div>
|
2171
|
+
|
2172
|
+
<div class="method_details ">
|
2173
|
+
<h3 class="signature " id="run_as_replacement-instance_method">
|
2174
|
+
|
2175
|
+
- (<tt>Object</tt>) <strong>run_as_replacement</strong>
|
2176
|
+
|
2177
|
+
|
2178
|
+
|
2179
|
+
<span class="aliases">Also known as:
|
2180
|
+
<span class="names"><span id='replace_us-instance_method'>replace_us</span></span>
|
2181
|
+
</span>
|
2182
|
+
|
2183
|
+
|
2184
|
+
|
2185
|
+
</h3><div class="docstring">
|
2186
|
+
<div class="discussion">
|
2187
|
+
|
2188
|
+
<p>Fork a new process for the command, then terminate our process.</p>
|
2189
|
+
|
2190
|
+
|
2191
|
+
</div>
|
2192
|
+
</div>
|
2193
|
+
<div class="tags">
|
2194
|
+
|
2195
|
+
|
2196
|
+
</div><table class="source_code">
|
2197
|
+
<tr>
|
2198
|
+
<td>
|
2199
|
+
<pre class="lines">
|
2200
|
+
|
2201
|
+
|
2202
|
+
102
|
2203
|
+
103
|
2204
|
+
104
|
2205
|
+
105
|
2206
|
+
106</pre>
|
2207
|
+
</td>
|
2208
|
+
<td>
|
2209
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 102</span>
|
2210
|
+
|
2211
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run_as_replacement'>run_as_replacement</span>
|
2212
|
+
<span class='id identifier rubyid_output_stream'>output_stream</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Ceding execution to: </span><span class='tstring_end'>"</span></span>
|
2213
|
+
<span class='id identifier rubyid_output_stream'>output_stream</span><span class='period'>.</span><span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_string_format'>string_format</span>
|
2214
|
+
<span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_exec'>exec</span><span class='lparen'>(</span><span class='id identifier rubyid_command_environment'>command_environment</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
2215
|
+
<span class='kw'>end</span></pre>
|
2216
|
+
</td>
|
2217
|
+
</tr>
|
2218
|
+
</table>
|
2219
|
+
</div>
|
2220
|
+
|
2221
|
+
<div class="method_details ">
|
2222
|
+
<h3 class="signature " id="run_detached-instance_method">
|
2223
|
+
|
2224
|
+
- (<tt>Object</tt>) <strong>run_detached</strong>
|
2225
|
+
|
2226
|
+
|
2227
|
+
|
2228
|
+
<span class="aliases">Also known as:
|
2229
|
+
<span class="names"><span id='spin_off-instance_method'>spin_off</span></span>
|
2230
|
+
</span>
|
2231
|
+
|
2232
|
+
|
2233
|
+
|
2234
|
+
</h3><div class="docstring">
|
2235
|
+
<div class="discussion">
|
2236
|
+
|
2237
|
+
<p>Run the command in the background. The command can survive the caller.</p>
|
2238
|
+
|
2239
|
+
|
2240
|
+
</div>
|
2241
|
+
</div>
|
2242
|
+
<div class="tags">
|
2243
|
+
|
2244
|
+
|
2245
|
+
</div><table class="source_code">
|
2246
|
+
<tr>
|
2247
|
+
<td>
|
2248
|
+
<pre class="lines">
|
2249
|
+
|
2250
|
+
|
2251
|
+
110
|
2252
|
+
111
|
2253
|
+
112
|
2254
|
+
113
|
2255
|
+
114</pre>
|
2256
|
+
</td>
|
2257
|
+
<td>
|
2258
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 110</span>
|
2259
|
+
|
2260
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run_detached'>run_detached</span>
|
2261
|
+
<span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_out'>out</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='id identifier rubyid_spawn_process'>spawn_process</span>
|
2262
|
+
<span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_detach'>detach</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
|
2263
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_out'>out</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span>
|
2264
|
+
<span class='kw'>end</span></pre>
|
2265
|
+
</td>
|
2266
|
+
</tr>
|
2267
|
+
</table>
|
2268
|
+
</div>
|
2269
|
+
|
2270
|
+
<div class="method_details ">
|
2271
|
+
<h3 class="signature " id="run_in_background-instance_method">
|
2272
|
+
|
2273
|
+
- (<tt>Object</tt>) <strong>run_in_background</strong>
|
2274
|
+
|
2275
|
+
|
2276
|
+
|
2277
|
+
<span class="aliases">Also known as:
|
2278
|
+
<span class="names"><span id='background-instance_method'>background</span></span>
|
2279
|
+
</span>
|
2280
|
+
|
2281
|
+
|
2282
|
+
|
2283
|
+
</h3><div class="docstring">
|
2284
|
+
<div class="discussion">
|
2285
|
+
|
2286
|
+
<p>Run the command in parallel with the parent process - will kill it if it
|
2287
|
+
outlasts us</p>
|
2288
|
+
|
2289
|
+
|
2290
|
+
</div>
|
2291
|
+
</div>
|
2292
|
+
<div class="tags">
|
2293
|
+
|
2294
|
+
|
2295
|
+
</div><table class="source_code">
|
2296
|
+
<tr>
|
2297
|
+
<td>
|
2298
|
+
<pre class="lines">
|
2299
|
+
|
2300
|
+
|
2301
|
+
127
|
2302
|
+
128
|
2303
|
+
129
|
2304
|
+
130
|
2305
|
+
131
|
2306
|
+
132
|
2307
|
+
133
|
2308
|
+
134</pre>
|
2309
|
+
</td>
|
2310
|
+
<td>
|
2311
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 127</span>
|
2312
|
+
|
2313
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_run_in_background'>run_in_background</span>
|
2314
|
+
<span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_out'>out</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span> <span class='op'>=</span> <span class='id identifier rubyid_spawn_process'>spawn_process</span>
|
2315
|
+
<span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_detach'>detach</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
|
2316
|
+
<span class='id identifier rubyid_at_exit'>at_exit</span> <span class='kw'>do</span>
|
2317
|
+
<span class='id identifier rubyid_kill_process'>kill_process</span><span class='lparen'>(</span><span class='id identifier rubyid_pid'>pid</span><span class='rparen'>)</span>
|
2318
|
+
<span class='kw'>end</span>
|
2319
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_out'>out</span><span class='comma'>,</span> <span class='id identifier rubyid_err'>err</span>
|
2320
|
+
<span class='kw'>end</span></pre>
|
2321
|
+
</td>
|
2322
|
+
</tr>
|
2323
|
+
</table>
|
2324
|
+
</div>
|
2325
|
+
|
2326
|
+
<div class="method_details ">
|
2327
|
+
<h3 class="signature " id="set_env-instance_method">
|
2328
|
+
|
2329
|
+
- (<tt>Object</tt>) <strong>set_env</strong>(name, value)
|
2330
|
+
|
2331
|
+
|
2332
|
+
|
2333
|
+
|
2334
|
+
|
2335
|
+
</h3><table class="source_code">
|
2336
|
+
<tr>
|
2337
|
+
<td>
|
2338
|
+
<pre class="lines">
|
2339
|
+
|
2340
|
+
|
2341
|
+
26
|
2342
|
+
27
|
2343
|
+
28
|
2344
|
+
29</pre>
|
2345
|
+
</td>
|
2346
|
+
<td>
|
2347
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 26</span>
|
2348
|
+
|
2349
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_env'>set_env</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
2350
|
+
<span class='id identifier rubyid_command_environment'>command_environment</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
2351
|
+
<span class='kw'>return</span> <span class='kw'>self</span>
|
2352
|
+
<span class='kw'>end</span></pre>
|
2353
|
+
</td>
|
2354
|
+
</tr>
|
2355
|
+
</table>
|
2356
|
+
</div>
|
2357
|
+
|
2358
|
+
<div class="method_details ">
|
2359
|
+
<h3 class="signature " id="spawn_process-instance_method">
|
2360
|
+
|
2361
|
+
- (<tt>Object</tt>) <strong>spawn_process</strong>
|
2362
|
+
|
2363
|
+
|
2364
|
+
|
2365
|
+
|
2366
|
+
|
2367
|
+
</h3><table class="source_code">
|
2368
|
+
<tr>
|
2369
|
+
<td>
|
2370
|
+
<pre class="lines">
|
2371
|
+
|
2372
|
+
|
2373
|
+
170
|
2374
|
+
171
|
2375
|
+
172
|
2376
|
+
173
|
2377
|
+
174
|
2378
|
+
175
|
2379
|
+
176
|
2380
|
+
177
|
2381
|
+
178
|
2382
|
+
179</pre>
|
2383
|
+
</td>
|
2384
|
+
<td>
|
2385
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 170</span>
|
2386
|
+
|
2387
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_spawn_process'>spawn_process</span>
|
2388
|
+
<span class='id identifier rubyid_host_stdout'>host_stdout</span><span class='comma'>,</span> <span class='id identifier rubyid_cmd_stdout'>cmd_stdout</span> <span class='op'>=</span> <span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_pipe'>pipe</span>
|
2389
|
+
<span class='id identifier rubyid_host_stderr'>host_stderr</span><span class='comma'>,</span> <span class='id identifier rubyid_cmd_stderr'>cmd_stderr</span> <span class='op'>=</span> <span class='const'>IO</span><span class='period'>.</span><span class='id identifier rubyid_pipe'>pipe</span>
|
2390
|
+
|
2391
|
+
<span class='id identifier rubyid_pid'>pid</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_spawn'>spawn</span><span class='lparen'>(</span><span class='id identifier rubyid_command_environment'>command_environment</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='symbol'>:out</span> <span class='op'>=></span> <span class='id identifier rubyid_cmd_stdout'>cmd_stdout</span><span class='comma'>,</span> <span class='symbol'>:err</span> <span class='op'>=></span> <span class='id identifier rubyid_cmd_stderr'>cmd_stderr</span><span class='rparen'>)</span>
|
2392
|
+
<span class='id identifier rubyid_cmd_stdout'>cmd_stdout</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
2393
|
+
<span class='id identifier rubyid_cmd_stderr'>cmd_stderr</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
2394
|
+
|
2395
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_pid'>pid</span><span class='comma'>,</span> <span class='id identifier rubyid_host_stdout'>host_stdout</span><span class='comma'>,</span> <span class='id identifier rubyid_host_stderr'>host_stderr</span>
|
2396
|
+
<span class='kw'>end</span></pre>
|
2397
|
+
</td>
|
2398
|
+
</tr>
|
2399
|
+
</table>
|
2400
|
+
</div>
|
2401
|
+
|
2402
|
+
<div class="method_details ">
|
2403
|
+
<h3 class="signature " id="string_format-instance_method">
|
2404
|
+
|
2405
|
+
- (<tt>Object</tt>) <strong>string_format</strong>
|
2406
|
+
|
2407
|
+
|
2408
|
+
|
2409
|
+
|
2410
|
+
|
2411
|
+
</h3><div class="docstring">
|
2412
|
+
<div class="discussion">
|
2413
|
+
|
2414
|
+
<p>The command as a string, including arguments and options, plus prefixed
|
2415
|
+
environment variables.</p>
|
2416
|
+
|
2417
|
+
|
2418
|
+
</div>
|
2419
|
+
</div>
|
2420
|
+
<div class="tags">
|
2421
|
+
|
2422
|
+
|
2423
|
+
</div><table class="source_code">
|
2424
|
+
<tr>
|
2425
|
+
<td>
|
2426
|
+
<pre class="lines">
|
2427
|
+
|
2428
|
+
|
2429
|
+
46
|
2430
|
+
47
|
2431
|
+
48
|
2432
|
+
49
|
2433
|
+
50</pre>
|
2434
|
+
</td>
|
2435
|
+
<td>
|
2436
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 46</span>
|
2437
|
+
|
2438
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_string_format'>string_format</span>
|
2439
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_command_environment'>command_environment</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
2440
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2441
|
+
<span class='kw'>end</span> <span class='op'>+</span> <span class='lbracket'>[</span><span class='id identifier rubyid_command'>command</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
2442
|
+
<span class='kw'>end</span></pre>
|
2443
|
+
</td>
|
2444
|
+
</tr>
|
2445
|
+
</table>
|
2446
|
+
</div>
|
2447
|
+
|
2448
|
+
<div class="method_details ">
|
2449
|
+
<h3 class="signature " id="succeeds?-instance_method">
|
2450
|
+
|
2451
|
+
- (<tt>Boolean</tt>) <strong>succeeds?</strong>
|
2452
|
+
|
2453
|
+
|
2454
|
+
|
2455
|
+
|
2456
|
+
|
2457
|
+
</h3><div class="docstring">
|
2458
|
+
<div class="discussion">
|
2459
|
+
|
2460
|
+
|
2461
|
+
</div>
|
2462
|
+
</div>
|
2463
|
+
<div class="tags">
|
2464
|
+
|
2465
|
+
<p class="tag_title">Returns:</p>
|
2466
|
+
<ul class="return">
|
2467
|
+
|
2468
|
+
<li>
|
2469
|
+
|
2470
|
+
|
2471
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
2472
|
+
|
2473
|
+
|
2474
|
+
|
2475
|
+
</li>
|
2476
|
+
|
2477
|
+
</ul>
|
2478
|
+
|
2479
|
+
</div><table class="source_code">
|
2480
|
+
<tr>
|
2481
|
+
<td>
|
2482
|
+
<pre class="lines">
|
2483
|
+
|
2484
|
+
|
2485
|
+
162
|
2486
|
+
163
|
2487
|
+
164</pre>
|
2488
|
+
</td>
|
2489
|
+
<td>
|
2490
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 162</span>
|
2491
|
+
|
2492
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_succeeds?'>succeeds?</span>
|
2493
|
+
<span class='id identifier rubyid_run'>run</span><span class='period'>.</span><span class='id identifier rubyid_succeeded?'>succeeded?</span>
|
2494
|
+
<span class='kw'>end</span></pre>
|
2495
|
+
</td>
|
2496
|
+
</tr>
|
2497
|
+
</table>
|
2498
|
+
</div>
|
2499
|
+
|
2500
|
+
<div class="method_details ">
|
2501
|
+
<h3 class="signature " id="verbose-instance_method">
|
2502
|
+
|
2503
|
+
- (<tt>Object</tt>) <strong>verbose</strong>
|
2504
|
+
|
2505
|
+
|
2506
|
+
|
2507
|
+
|
2508
|
+
|
2509
|
+
</h3><table class="source_code">
|
2510
|
+
<tr>
|
2511
|
+
<td>
|
2512
|
+
<pre class="lines">
|
2513
|
+
|
2514
|
+
|
2515
|
+
31
|
2516
|
+
32
|
2517
|
+
33</pre>
|
2518
|
+
</td>
|
2519
|
+
<td>
|
2520
|
+
<pre class="code"><span class="info file"># File 'lib/caliph/command-line.rb', line 31</span>
|
2521
|
+
|
2522
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_verbose'>verbose</span>
|
2523
|
+
<span class='comment'>#::Rake.verbose && ::Rake.verbose != ::Rake::FileUtilsExt::DEFAULT
|
2524
|
+
</span><span class='kw'>end</span></pre>
|
2525
|
+
</td>
|
2526
|
+
</tr>
|
2527
|
+
</table>
|
2528
|
+
</div>
|
2529
|
+
|
2530
|
+
</div>
|
2531
|
+
|
2532
|
+
</div>
|
2533
|
+
|
2534
|
+
<div id="footer">
|
2535
|
+
Generated on Fri Jun 13 17:31:08 2014 by
|
2536
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2537
|
+
0.8.7.4 (ruby-2.0.0).
|
2538
|
+
</div>
|
2539
|
+
|
2540
|
+
</body>
|
2541
|
+
</html>
|