Module: Jekyll::LastModifiedAt::Executor
- Extended by:
- POSIX::Spawn
- Defined in:
- lib/jekyll-last-modified-at/executor.rb
Class Method Summary collapse
Class Method Details
.sh(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll-last-modified-at/executor.rb', line 8 def self.sh(*args) r, w = IO.pipe e, eo = IO.pipe pid = spawn(*args, { :out => w, r => :close, :err => eo, e => :close }) if pid > 0 w.close eo.close out = r.read err = e.read ::Process.waitpid(pid) if out "#{out} #{err}".strip end end ensure [r, w, e, eo].each{ |io| io.close rescue nil } end |