rbatch 1.6.6 → 1.7.0
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.
- data/README.ja.md +11 -11
- data/README.md +12 -12
- data/Rakefile +2 -2
- data/doc/rdoc/CHANGELOG.html +144 -163
- data/doc/rdoc/LICENSE.html +79 -73
- data/doc/rdoc/RBatch/Cmd.html +293 -308
- data/doc/rdoc/RBatch/CmdException.html +141 -140
- data/doc/rdoc/RBatch/CmdResult.html +462 -469
- data/doc/rdoc/RBatch/Config.html +314 -329
- data/doc/rdoc/RBatch/Log.html +677 -709
- data/doc/rdoc/RBatch.html +425 -432
- data/doc/rdoc/created.rid +8 -8
- data/doc/rdoc/index.html +123 -117
- data/doc/rdoc/lib/rbatch/cmd_rb.html +42 -42
- data/doc/rdoc/lib/rbatch/config_rb.html +42 -42
- data/doc/rdoc/lib/rbatch/log_rb.html +44 -44
- data/doc/rdoc/lib/rbatch_rb.html +44 -44
- data/doc/rdoc/rdoc.css +365 -308
- data/lib/rbatch/log.rb +13 -3
- data/sample/bin/log_backup.rb +20 -0
- data/sample/conf/log_backup.yaml +4 -0
- data/sample/log/20130129_log_backup.log +95 -0
- data/test/cases/test_log.rb +0 -7
- metadata +6 -3
data/doc/rdoc/RBatch/Cmd.html
CHANGED
@@ -1,332 +1,317 @@
|
|
1
|
-
<?xml version="1.0" encoding="
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
|
3
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
5
|
<head>
|
6
|
-
|
6
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
7
7
|
|
8
|
-
|
8
|
+
<title>Class: RBatch::Cmd</title>
|
9
9
|
|
10
|
-
|
10
|
+
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
-
charset="utf-8"></script>
|
18
|
-
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
-
charset="utf-8"></script>
|
12
|
+
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
13
|
+
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
+
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
+
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
20
16
|
|
21
17
|
</head>
|
22
|
-
<body class="class">
|
18
|
+
<body id="top" class="class">
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
<div id="metadata">
|
21
|
+
<div id="home-metadata">
|
22
|
+
<div id="home-section" class="section">
|
27
23
|
<h3 class="section-header">
|
28
24
|
<a href="../index.html">Home</a>
|
29
25
|
<a href="../index.html#classes">Classes</a>
|
30
26
|
<a href="../index.html#methods">Methods</a>
|
31
27
|
</h3>
|
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
|
-
</li>
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
</
|
157
|
-
<
|
158
|
-
|
159
|
-
|
160
|
-
</p>
|
161
|
-
</li>
|
162
|
-
</ul>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="file-metadata">
|
32
|
+
<div id="file-list-section" class="section">
|
33
|
+
<h3 class="section-header">In Files</h3>
|
34
|
+
<div class="section-body">
|
35
|
+
<ul>
|
36
|
+
|
37
|
+
<li><a href="../lib/rbatch/cmd_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
+
class="thickbox" title="lib/rbatch/cmd.rb">lib/rbatch/cmd.rb</a></li>
|
39
|
+
|
40
|
+
</ul>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="class-metadata">
|
48
|
+
|
49
|
+
<!-- Parent Class -->
|
50
|
+
<div id="parent-class-section" class="section">
|
51
|
+
<h3 class="section-header">Parent</h3>
|
52
|
+
|
53
|
+
<p class="link">Object</p>
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!-- Method Quickref -->
|
64
|
+
<div id="method-list-section" class="section">
|
65
|
+
<h3 class="section-header">Methods</h3>
|
66
|
+
<ul class="link-list">
|
67
|
+
|
68
|
+
<li><a href="#method-c-new">::new</a></li>
|
69
|
+
|
70
|
+
<li><a href="#method-i-run">#run</a></li>
|
71
|
+
|
72
|
+
</ul>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="project-metadata">
|
80
|
+
|
81
|
+
|
82
|
+
<div id="fileindex-section" class="section project-section">
|
83
|
+
<h3 class="section-header">Files</h3>
|
84
|
+
<ul>
|
85
|
+
|
86
|
+
<li class="file"><a href="../CHANGELOG.html">CHANGELOG</a></li>
|
87
|
+
|
88
|
+
<li class="file"><a href="../LICENSE.html">LICENSE</a></li>
|
89
|
+
|
90
|
+
</ul>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
<div id="classindex-section" class="section project-section">
|
95
|
+
<h3 class="section-header">Class/Module Index
|
96
|
+
<span class="search-toggle"><img src="../images/find.png"
|
97
|
+
height="16" width="16" alt="[+]"
|
98
|
+
title="show/hide quicksearch" /></span></h3>
|
99
|
+
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
100
|
+
<fieldset>
|
101
|
+
<legend>Quicksearch</legend>
|
102
|
+
<input type="text" name="quicksearch" value=""
|
103
|
+
class="quicksearch-field" />
|
104
|
+
</fieldset>
|
105
|
+
</form>
|
106
|
+
|
107
|
+
<ul class="link-list">
|
108
|
+
|
109
|
+
<li><a href="../RBatch.html">RBatch</a></li>
|
110
|
+
|
111
|
+
<li><a href="../RBatch/Cmd.html">RBatch::Cmd</a></li>
|
112
|
+
|
113
|
+
<li><a href="../RBatch/CmdException.html">RBatch::CmdException</a></li>
|
114
|
+
|
115
|
+
<li><a href="../RBatch/CmdResult.html">RBatch::CmdResult</a></li>
|
116
|
+
|
117
|
+
<li><a href="../RBatch/Config.html">RBatch::Config</a></li>
|
118
|
+
|
119
|
+
<li><a href="../RBatch/Log.html">RBatch::Log</a></li>
|
120
|
+
|
121
|
+
<li><a href="../RBatch/RBatch.html">RBatch::RBatch</a></li>
|
122
|
+
|
123
|
+
<li><a href="../RBatch/RBatch/RBatch.html">RBatch::RBatch::RBatch</a></li>
|
124
|
+
|
125
|
+
<li><a href="../RBatch/RBatch/RBatch/Config.html">RBatch::RBatch::RBatch::Config</a></li>
|
126
|
+
|
127
|
+
<li><a href="../RBatch/RBatch/RBatch/Config/Exception.html">RBatch::RBatch::RBatch::Config::Exception</a></li>
|
128
|
+
|
129
|
+
</ul>
|
130
|
+
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div id="documentation">
|
138
|
+
<h1 class="class">RBatch::Cmd</h1>
|
139
|
+
|
140
|
+
<div id="description" class="description">
|
141
|
+
|
142
|
+
<p>External command runcher.</p>
|
143
|
+
<ul><li>
|
144
|
+
<p>Input cmd_params into Kernel#spawn.</p>
|
145
|
+
</li><li>
|
146
|
+
<p>Write command’s stdout and stderr to tmp file.</p>
|
147
|
+
</li><li>
|
148
|
+
<p>If Platform is “mswin” or “mingw” , then temp directory is <a
|
149
|
+
href="http://"TEMP"">ENV</a></p>
|
150
|
+
</li><li>
|
151
|
+
<p>If Platform is “linux” or “cygwin” , then temp directory is “/tmp/”</p>
|
152
|
+
</li><li>
|
153
|
+
<p>Return hash object including stdout, stderr, and exit status.</p>
|
154
|
+
</li></ul>
|
155
|
+
|
163
156
|
<h4>Sample 1</h4>
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
157
|
+
|
158
|
+
<pre>require 'rbatch'
|
159
|
+
cmd = RBatch::Cmd("ls")
|
160
|
+
r = cmd.run
|
161
|
+
p r.stdout
|
162
|
+
=> "fileA\nfileB\n"</pre>
|
163
|
+
|
171
164
|
<h4>Sample 2 ( Use option)</h4>
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
165
|
+
|
166
|
+
<pre>cmd = RBatch::Cmd("ls", {:verbose => true})
|
167
|
+
r = cmd.run</pre>
|
168
|
+
|
176
169
|
<h4>Sample 3 ( Use alias)</h4>
|
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
|
-
|
170
|
+
|
171
|
+
<pre>require 'rbatch'
|
172
|
+
r = RBatch::cmd("ls")
|
173
|
+
p r.stdout
|
174
|
+
=> "fileA\nfileB\n"</pre>
|
175
|
+
|
176
|
+
</div><!-- description -->
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<div id="5Buntitled-5D" class="documentation-section">
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<!-- Methods -->
|
191
|
+
|
192
|
+
<div id="public-class-method-details" class="method-section section">
|
193
|
+
<h3 class="section-header">Public Class Methods</h3>
|
194
|
+
|
195
|
+
|
196
|
+
<div id="new-method" class="method-detail ">
|
197
|
+
<a name="method-c-new"></a>
|
198
|
+
|
199
|
+
|
200
|
+
<div class="method-heading">
|
201
|
+
<span class="method-name">new</span><span
|
202
|
+
class="method-args">(cmd_str,opt = nil)</span>
|
203
|
+
<span class="method-click-advice">click to toggle source</span>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
|
207
|
+
<div class="method-description">
|
208
|
+
|
209
|
+
<p><a href="Cmd.html">Cmd</a> instance</p>
|
210
|
+
|
213
211
|
<h4>Params</h4>
|
214
|
-
|
215
|
-
<tt>cmd_str</tt> = Command string. Such ad
|
216
|
-
|
217
|
-
|
218
|
-
<
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
<div class="method-source-code"
|
229
|
-
id="new-source">
|
212
|
+
|
213
|
+
<p><tt>cmd_str</tt> = Command string. Such ad "ls -l" <tt>opt</tt> = Option
|
214
|
+
hash object. Hash keys is follows.</p>
|
215
|
+
<ul><li>
|
216
|
+
<p><tt>:raise</tt> (Boolean) = If command exit status is not 0, raise
|
217
|
+
exception. Default is false.</p>
|
218
|
+
</li></ul>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<div class="method-source-code" id="new-source">
|
230
223
|
<pre>
|
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
|
-
</p>
|
224
|
+
<span class="ruby-comment"># File lib/rbatch/cmd.rb, line 44</span>
|
225
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">cmd_str</span>,<span class="ruby-identifier">opt</span> = <span class="ruby-keyword">nil</span>)
|
226
|
+
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">CmdException</span>,<span class="ruby-string">"Command string is nil"</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">cmd_str</span>.<span class="ruby-identifier">nil?</span>
|
227
|
+
<span class="ruby-ivar">@cmd_str</span> = <span class="ruby-identifier">cmd_str</span>
|
228
|
+
<span class="ruby-comment"># parse option</span>
|
229
|
+
<span class="ruby-ivar">@opt</span> = <span class="ruby-identifier">@@def_opt</span>.<span class="ruby-identifier">clone</span>
|
230
|
+
<span class="ruby-identifier">@@def_opt</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
231
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">opt</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
232
|
+
<span class="ruby-comment"># use argument</span>
|
233
|
+
<span class="ruby-ivar">@opt</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">key</span>]
|
234
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span>[<span class="ruby-string">"cmd_"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
235
|
+
<span class="ruby-comment"># use config</span>
|
236
|
+
<span class="ruby-ivar">@opt</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span>[<span class="ruby-string">"cmd_"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>]
|
237
|
+
<span class="ruby-keyword">else</span>
|
238
|
+
<span class="ruby-comment"># use default</span>
|
239
|
+
<span class="ruby-keyword">end</span>
|
240
|
+
<span class="ruby-keyword">end</span>
|
241
|
+
<span class="ruby-keyword">end</span></pre>
|
242
|
+
</div><!-- new-source -->
|
243
|
+
|
244
|
+
</div>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
</div><!-- new-method -->
|
250
|
+
|
251
|
+
|
252
|
+
</div><!-- public-class-method-details -->
|
253
|
+
|
254
|
+
<div id="public-instance-method-details" class="method-section section">
|
255
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
256
|
+
|
257
|
+
|
258
|
+
<div id="run-method" class="method-detail ">
|
259
|
+
<a name="method-i-run"></a>
|
260
|
+
|
261
|
+
|
262
|
+
<div class="method-heading">
|
263
|
+
<span class="method-name">run</span><span
|
264
|
+
class="method-args">()</span>
|
265
|
+
<span class="method-click-advice">click to toggle source</span>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
|
269
|
+
<div class="method-description">
|
270
|
+
|
271
|
+
<p>Run command</p>
|
272
|
+
|
281
273
|
<h4>Return</h4>
|
282
|
-
|
283
|
-
instance of <a href="CmdResult.html">RBatch::CmdResult</a>
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
<div class="method-source-code"
|
289
|
-
id="run-source">
|
274
|
+
|
275
|
+
<p>instance of <a href="CmdResult.html">RBatch::CmdResult</a></p>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<div class="method-source-code" id="run-source">
|
290
280
|
<pre>
|
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
|
-
<div id="validator-badges">
|
326
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
327
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
328
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
329
|
-
</div>
|
281
|
+
<span class="ruby-comment"># File lib/rbatch/cmd.rb, line 67</span>
|
282
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>()
|
283
|
+
<span class="ruby-identifier">stdout_file</span> = <span class="ruby-constant">Tempfile</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-string">"rbatch_tmpout"</span>,<span class="ruby-constant">RBatch</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmp_dir</span>)
|
284
|
+
<span class="ruby-identifier">stderr_file</span> = <span class="ruby-constant">Tempfile</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-string">"rbatch_tmperr"</span>,<span class="ruby-constant">RBatch</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmp_dir</span>)
|
285
|
+
<span class="ruby-identifier">pid</span> = <span class="ruby-identifier">spawn</span>(<span class="ruby-ivar">@cmd_str</span>,<span class="ruby-value">:out</span> =<span class="ruby-operator">></span> [<span class="ruby-identifier">stdout_file</span>,<span class="ruby-string">"w"</span>],<span class="ruby-value">:err</span> =<span class="ruby-operator">></span> [<span class="ruby-identifier">stderr_file</span>,<span class="ruby-string">"w"</span>])
|
286
|
+
<span class="ruby-identifier">status</span> = <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid2</span>(<span class="ruby-identifier">pid</span>)[<span class="ruby-value">1</span>] <span class="ruby-operator">>></span> <span class="ruby-value">8</span>
|
287
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-constant">RBatch</span><span class="ruby-operator">::</span><span class="ruby-constant">CmdResult</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">stdout_file</span>,<span class="ruby-identifier">stderr_file</span>,<span class="ruby-identifier">status</span>,<span class="ruby-ivar">@cmd_str</span>)
|
288
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:raise</span>] <span class="ruby-operator">&&</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
|
289
|
+
<span class="ruby-identifier">raise</span>(<span class="ruby-constant">CmdException</span>,<span class="ruby-string">"Command exit status is not 0. result: "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">to_s</span>)
|
290
|
+
<span class="ruby-keyword">end</span>
|
291
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
292
|
+
<span class="ruby-keyword">end</span></pre>
|
293
|
+
</div><!-- run-source -->
|
294
|
+
|
295
|
+
</div>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
</div><!-- run-method -->
|
301
|
+
|
302
|
+
|
303
|
+
</div><!-- public-instance-method-details -->
|
304
|
+
|
305
|
+
</div><!-- 5Buntitled-5D -->
|
306
|
+
|
307
|
+
|
308
|
+
</div><!-- documentation -->
|
309
|
+
|
310
|
+
<div id="validator-badges">
|
311
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
312
|
+
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
313
|
+
Rdoc Generator</a> 2</small>.</p>
|
314
|
+
</div>
|
330
315
|
|
331
316
|
</body>
|
332
317
|
</html>
|