Class: CommandTool

Inherits:
Object
  • Object
show all
Defined in:
lib/gitsync/command_tool.rb

Class Method Summary collapse

Class Method Details

.exccmd(cmd) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/gitsync/command_tool.rb', line 4

def self.exccmd(cmd)
  Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
    result = wait_thr.value
    return { succ: result.success?,
             msg: stdout.gets(nil) || stderr.gets(nil) }
  end
rescue StandardError => e
  return { succ: false, msg: e }
end