Class: Kward::CodeSearch::GitRunner
- Inherits:
-
Object
- Object
- Kward::CodeSearch::GitRunner
- Defined in:
- lib/kward/tools/search/code.rb
Instance Method Summary collapse
Instance Method Details
#run(*args, chdir: nil) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/kward/tools/search/code.rb', line 69 def run(*args, chdir: nil) command = ["git", *args] stdout, stderr, status = chdir ? Open3.capture3(*command, chdir: chdir) : Open3.capture3(*command) raise "git #{args.join(" ")} failed: #{stderr.strip.empty? ? stdout.strip : stderr.strip}" unless status.success? stdout rescue Errno::ENOENT raise "git executable not found" end |