Class: Git::Shell
- Inherits:
-
Object
- Object
- Git::Shell
- Defined in:
- lib/mono/git/base.rb
Overview
use nested class for “base” for running commands - why? why not?
Class Method Summary collapse
Class Method Details
.run(cmd) ⇒ Object
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 152 153 154 155 156 |
# File 'lib/mono/git/base.rb', line 126 def self.run( cmd ) print "cmd exec >#{cmd}<..." stdout, stderr, status = Open3.capture3( cmd ) if status.success? print " OK" print "\n" else print " FAIL (#{status.exitstatus})" print "\n" end unless stdout.empty? puts stdout end unless stderr.empty? ## todo/check: or use >2: or &2: or such ## stderr output not always an error (that is, exit status might be 0) puts "STDERR:" puts stderr end if status.success? stdout # return stdout string else puts "!! ERROR: cmd exec >#{cmd}< failed with exit status #{status.exitstatus}:" puts stderr raise GitError, "git cmd exec >#{cmd}< failed with exit status #{status.exitstatus}<: #{stderr}" end end |