2015-12-30 18:42:11 -05:00
---
2016-01-14 16:38:37 -05:00
- :left :
:type : match
:number : 6
:text : "@@ -6,12 +6,18 @@ module Popen"
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
:right :
:type : match
:number : 6
:text : "@@ -6,12 +6,18 @@ module Popen"
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 6
:text : |2
<span id="LC6" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 6
:text : |2
<span id="LC6" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 7
:text : |2
<span id="LC7" class="line"> <span class="k">def</span> <span class="nf">popen</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="kp">nil</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 7
:text : |2
<span id="LC7" class="line"> <span class="k">def</span> <span class="nf">popen</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="kp">nil</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 8
:text : |2
<span id="LC8" class="line"> <span class="k">unless</span> <span class="n">cmd</span><span class="p">.</span><span class="nf">is_a?</span><span class="p">(</span><span class="no">Array</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 8
:text : |2
<span id="LC8" class="line"> <span class="k">unless</span> <span class="n">cmd</span><span class="p">.</span><span class="nf">is_a?</span><span class="p">(</span><span class="no">Array</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8
- :left :
:type : old
:number : 9
:text : |
-<span id="LC9" class="line"> <span class="k">raise</span> <span class="s2">"System commands must be given as an array of strings"</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9
:right :
:type : new
:number : 9
:text : |
2016-01-29 13:37:17 -05:00
+<span id="LC9" class="line"> <span class="k">raise</span> <span class="no"><span class='idiff left'>RuntimeError</span></span><span class="p"><span class='idiff'>,</span></span><span class='idiff right'> </span><span class="s2">"System commands must be given as an array of strings"</span></span>
2016-01-14 16:38:37 -05:00
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 10
:text : |2
<span id="LC10" class="line"> <span class="k">end</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 10
:text : |2
<span id="LC10" class="line"> <span class="k">end</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 11
:text : |2
<span id="LC11" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_11_11
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 11
:text : |2
<span id="LC11" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_11_11
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 12
:text : |2
<span id="LC12" class="line"> <span class="n">path</span> <span class="o">||=</span> <span class="no">Dir</span><span class="p">.</span><span class="nf">pwd</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_12_12
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 12
:text : |2
<span id="LC12" class="line"> <span class="n">path</span> <span class="o">||=</span> <span class="no">Dir</span><span class="p">.</span><span class="nf">pwd</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_12_12
- :left :
:type : old
:number : 13
:text : |
-<span id="LC13" class="line"> <span class="n">vars</span> <span class="o">=</span> <span class="p">{</span> <span class="s2">"PWD"</span> <span class="o">=></span> <span class="n">path</span> <span class="p">}</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13
:right :
:type : old
2016-01-19 08:52:41 -05:00
:number :
2016-01-14 16:38:37 -05:00
:text : ''
2016-01-19 08:52:41 -05:00
:line_code :
2016-01-14 16:38:37 -05:00
- :left :
:type : old
:number : 14
:text : |
-<span id="LC14" class="line"> <span class="n">options</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">chdir: </span><span class="n">path</span> <span class="p">}</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_14_13
:right :
:type : new
:number : 13
:text : |
+<span id="LC13" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_13
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14
:right :
:type : new
:number : 14
:text : |
+<span id="LC14" class="line"> <span class="n">vars</span> <span class="o">=</span> <span class="p">{</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15
:right :
:type : new
:number : 15
:text : |
+<span id="LC15" class="line"> <span class="s2">"PWD"</span> <span class="o">=></span> <span class="n">path</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_16
:right :
:type : new
:number : 16
:text : |
+<span id="LC16" class="line"> <span class="p">}</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_16
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_17
:right :
:type : new
:number : 17
:text : |
+<span id="LC17" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_17
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_18
:right :
:type : new
:number : 18
:text : |
+<span id="LC18" class="line"> <span class="n">options</span> <span class="o">=</span> <span class="p">{</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_18
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_19
:right :
:type : new
:number : 19
:text : |
+<span id="LC19" class="line"> <span class="ss">chdir: </span><span class="n">path</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_19
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_20
:right :
:type : new
:number : 20
:text : |
+<span id="LC20" class="line"> <span class="p">}</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_20
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 15
:text : |2
<span id="LC21" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_21
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 21
:text : |2
<span id="LC21" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_21
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 16
:text : |2
<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_16_22
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 22
:text : |2
<span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_16_22
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 17
:text : |2
<span id="LC23" class="line"> <span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkdir_p</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_17_23
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 23
:text : |2
<span id="LC23" class="line"> <span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkdir_p</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_17_23
- :left :
:type : match
:number : 19
:text : "@@ -19,6 +25,7 @@ module Popen"
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
:right :
:type : match
:number : 25
:text : "@@ -19,6 +25,7 @@ module Popen"
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 19
:text : |2
<span id="LC25" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 25
:text : |2
<span id="LC25" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 20
:text : |2
<span id="LC26" class="line"> <span class="vi">@cmd_output</span> <span class="o">=</span> <span class="s2">""</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_20_26
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 26
:text : |2
<span id="LC26" class="line"> <span class="vi">@cmd_output</span> <span class="o">=</span> <span class="s2">""</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_20_26
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 21
:text : |2
<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_21_27
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 27
:text : |2
<span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_21_27
- :left :
2016-01-19 08:52:41 -05:00
:type :
:number :
2016-01-14 16:38:37 -05:00
:text : ''
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_28
:right :
:type : new
:number : 28
:text : |
+<span id="LC28" class="line"></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_28
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 22
:text : |2
<span id="LC29" class="line"> <span class="no">Open3</span><span class="p">.</span><span class="nf">popen3</span><span class="p">(</span><span class="n">vars</span><span class="p">,</span> <span class="o">*</span><span class="n">cmd</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">,</span> <span class="n">wait_thr</span><span class="o">|</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_29
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 29
:text : |2
<span id="LC29" class="line"> <span class="no">Open3</span><span class="p">.</span><span class="nf">popen3</span><span class="p">(</span><span class="n">vars</span><span class="p">,</span> <span class="o">*</span><span class="n">cmd</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">,</span> <span class="n">wait_thr</span><span class="o">|</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_29
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 23
:text : |2
<span id="LC30" class="line"> <span class="vi">@cmd_output</span> <span class="o"><<</span> <span class="n">stdout</span><span class="p">.</span><span class="nf">read</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_23_30
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 30
:text : |2
<span id="LC30" class="line"> <span class="vi">@cmd_output</span> <span class="o"><<</span> <span class="n">stdout</span><span class="p">.</span><span class="nf">read</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_23_30
- :left :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 24
:text : |2
<span id="LC31" class="line"> <span class="vi">@cmd_output</span> <span class="o"><<</span> <span class="n">stderr</span><span class="p">.</span><span class="nf">read</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_24_31
:right :
2016-01-19 08:52:41 -05:00
:type :
2016-01-14 16:38:37 -05:00
:number : 31
:text : |2
<span id="LC31" class="line"> <span class="vi">@cmd_output</span> <span class="o"><<</span> <span class="n">stderr</span><span class="p">.</span><span class="nf">read</span></span>
:line_code : 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_24_31