Skip to content

Commit

Permalink
Merge pull request #14 from nurey/handle_permission_denied
Browse files Browse the repository at this point in the history
Expose the `permission denied (publickey)` error when using ssh.
  • Loading branch information
jbussdieker committed Oct 11, 2017
2 parents 01cdddf + 553f3e5 commit 38f529d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rsync/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def error
error_key = @exitcode.to_s
if ERROR_CODES.has_key? error_key
ERROR_CODES[error_key]
elsif @raw =~ /Permission denied \(publickey\)/
"Permission denied (publickey)"
else
"Unknown Error"
end
Expand Down
8 changes: 8 additions & 0 deletions spec/rsync/result_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@
expect(result.success?).to eql(false)
expect(result.exitcode).to eql(1)
end

it "should handle ssh error" do
result = Rsync::Result.new("Permission denied (publickey)", 255)
expect(result.changes).to eql([])
expect(result.error).to eql("Permission denied (publickey)")
expect(result.success?).to eql(false)
expect(result.exitcode).to eql(255)
end
end

0 comments on commit 38f529d

Please sign in to comment.