+ STDOUT->blocking(0);
+ $web_socket->blocking(0);
+ $read_select->add($web_socket);
+ my $input_fh = \*STDIN;
+ $read_select->add($input_fh);
+
+ my $output_fh = \*STDOUT;
+
+ my $in_escape_sequence;
+
+ my $winch_received = 0;
+ $SIG{WINCH} = sub { $winch_received = 1; };
+
+ my $check_terminal_size = sub {
+ my ($ncols, $nrows) = PVE::PTY::tcgetsize(*STDIN);
+ if ($ncols != $columns or $nrows != $rows) {
+ $columns = $ncols;
+ $rows = $nrows;
+ $websock_buffer .= $create_websockt_frame->("1:$columns:$rows:");
+ $write_select->add($web_socket);
+ }
+ $winch_received = 0;
+ };