… | |
… | |
16 | } |
16 | } |
17 | |
17 | |
18 | sub wait_pipe { |
18 | sub wait_pipe { |
19 | my ($self, $fh, $pid, $msg) = @_; |
19 | my ($self, $fh, $pid, $msg) = @_; |
20 | |
20 | |
21 | $self->msg ("waiting for process to finish..."); |
21 | $self->msg ("waiting for selection process to finish..."); |
22 | |
22 | |
23 | my $wait_pipe; $wait_pipe = urxvt::pw->new->start ($pid)->cb (sub { |
23 | my $wait_pipe; $wait_pipe = urxvt::pw->new->start ($pid)->cb (sub { |
24 | my ($undef, $status) = @_; |
24 | my ($undef, $status) = @_; |
25 | undef $wait_pipe; |
25 | undef $wait_pipe; |
26 | close $fh; |
26 | close $fh; |
… | |
… | |
72 | $self->msg ((length $txt) . " chars read..."); |
72 | $self->msg ((length $txt) . " chars read..."); |
73 | } else { |
73 | } else { |
74 | delete $self->{iow}; |
74 | delete $self->{iow}; |
75 | $self->selection_clear; |
75 | $self->selection_clear; |
76 | $self->selection ($txt); |
76 | $self->selection ($txt); |
77 | $self->selection_make (urxvt::CurrentTime); |
77 | $self->selection_grab (urxvt::CurrentTime); |
78 | $self->wait_pipe ($fh, $pid, "selection fetched"); |
78 | close $fh; |
|
|
79 | my $status = $? >> 8; |
|
|
80 | $self->msg ("selection fetched (status $status)"); |
79 | } |
81 | } |
80 | }); |
82 | }); |
81 | } |
83 | } |
82 | } |
84 | } |
83 | |
85 | |