Skip to content

Commit

Permalink
make sure $! gets preserved
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 15, 2015
1 parent 9fd79e2 commit e36337a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/IOLoop/Client.pm
Expand Up @@ -100,9 +100,9 @@ sub _ready {
# Socket changes in between attempts and needs to be re-added for epoll/kqueue
if ($handle->isa('IO::Socket::IP')) {
$self->reactor->remove($handle);
my $res = $handle->connect;
my ($res, $err) = ($handle->connect, $!);
$self->_wait($handle, $args);
return $! == EINPROGRESS ? undef : $self->emit(error => $!) unless $res;
return $err == EINPROGRESS ? undef : $self->emit(error => $err) unless $res;
}

return $self->emit(error => $! || 'Not connected') unless $handle->connected;
Expand Down

0 comments on commit e36337a

Please sign in to comment.