Module: GitCli::Common

Includes:
Antrapol::ToolRack::ConditionUtils, Antrapol::ToolRack::ExceptionUtils
Included in:
Gvcs::Vcs, Gvcs::Workspace
Defined in:
lib/git_cli.rb

Instance Method Summary collapse

Instance Method Details

#log_debug(str) ⇒ Object



61
62
63
# File 'lib/git_cli.rb', line 61

def log_debug(str)
  GitCli::Global.instance.logger.debug(str)
end

#log_error(str) ⇒ Object



65
66
67
# File 'lib/git_cli.rb', line 65

def log_error(str)
  GitCli::Global.instance.logger.error(str)
end

#log_warn(str) ⇒ Object



69
70
71
# File 'lib/git_cli.rb', line 69

def log_warn(str)
  GitCli::Global.instance.logger.warn(str)
end

#os_exec(path, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/git_cli.rb', line 47

def os_exec(path, &block)
  # redirect stderr to stdout
  path = "#{path} 2>&1"
  res = Antrapol::ToolRack::ProcessUtilsEngine.exec(path)
  if block
    # $?.exitstatus => error codes
    # $?.success? => true / false
    # $?.pid => child PID
    block.call($?, res)
  else
    res.strip
  end
end