]> git.proxmox.com Git - pve-client.git/blobdiff - PVE/APIClient/Commands/lxc.pm
lxc enter: set STDOUT to non-blocking mode
[pve-client.git] / PVE / APIClient / Commands / lxc.pm
index 650b6b5273e9cdf8cfa9f052afa5659a2aebf090..c60017b551ebd750236568807d4b62d21e4c7024 100644 (file)
@@ -202,7 +202,9 @@ __PACKAGE__->register_method ({
 
        my $wb_socket_read_available_bytes = sub {
            my $nr = $web_socket->sysread($wsbuf, $max_payload_size, length($wsbuf));
-           die "web socket read error - $!\n" if $nr < 0;
+           if (!defined($nr) && !($! == EINTR || $! == EAGAIN)) {
+               die "web socket read error - $!\n";
+           }
            return $nr;
        };
 
@@ -258,7 +260,8 @@ __PACKAGE__->register_method ({
 
            # And set it to non-blocking so we can every char with IO::Select.
            STDIN->blocking(0);
-           $web_socket->blocking(1);
+           STDOUT->blocking(0);
+           $web_socket->blocking(0);
            $read_select->add($web_socket);
            my $input_fh = \*STDIN;
            $read_select->add($input_fh);
@@ -318,7 +321,7 @@ __PACKAGE__->register_method ({
 
                            my $nr = $wb_socket_read_available_bytes->();
                            if (!defined($nr)) {
-                               die "web socket read error $!\n";
+                               # wait
                            } elsif ($nr == 0) {
                                return; # EOF
                            } else {