Exception: Git::SignaledError

Inherits:
GitExecuteError show all
Defined in:
lib/git/signaled_error.rb

Overview

This error is raised when a git command exits because of an uncaught signal

The git command executed, status, stdout, and stderr are available from this object. The #message includes the git command, the status of the process, and the stderr of the process.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ SignaledError

Create a SignaledError object

Examples:

`kill -9 $$` # set $? appropriately for this example
result = Git::CommandLineResult.new(%w[git status], $?, '', "killed")
error = Git::SignaledError.new(result)
error.message #=>
  "[\"git\", \"status\"]\nstatus: pid 88811 SIGKILL (signal 9)\nstderr: \"killed\""

Parameters:

  • result (Git::CommandLineResult)

    the result of the git command including the git command, status, stdout, and stderr



26
27
28
29
# File 'lib/git/signaled_error.rb', line 26

def initialize(result)
  super("#{result.git_cmd}\nstatus: #{result.status}\nstderr: #{result.stderr.inspect}")
  @result = result
end

Instance Attribute Details

#resultGit::CommandLineResult (readonly)

The result of the git command including the git command, status, and output

Examples:

`kill -9 $$` # set $? appropriately for this example
result = Git::CommandLineResult.new(%w[git status], $?, '', "killed")
error = Git::SignaledError.new(result)
error.result #=>
  #<Git::CommandLineResult:0x000000010470f6e8
    @git_cmd=["git", "status"],
    @status=#<Process::Status: pid 88811 SIGKILL (signal 9)>,
    @stderr="killed",
    @stdout="">

Returns:



48
49
50
# File 'lib/git/signaled_error.rb', line 48

def result
  @result
end