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



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

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

#log_error(str) ⇒ Object



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

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

#log_warn(str) ⇒ Object



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

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

#os_exec(path, &block) ⇒ Object



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

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