From 72eb5c22cbe2787c9ff39cb319b04669d1757a5c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 16 Dec 2017 21:58:58 +0100 Subject: Remove second pipe We don't need this any more. It was supposed take the tempfile name from the child fork and open a Vim instance with that filename, but we found out we couldn't do that in the parent process, we had to do it in the fork. So we have no need to pass the tempfile name to the parent process and no need for this pipe. Also thankfully gets rid of obscenities. --- vimput.pl | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/vimput.pl b/vimput.pl index 2114d00..de64387 100644 --- a/vimput.pl +++ b/vimput.pl @@ -16,7 +16,6 @@ our %IRSSI = { }; -use constant VIMPUT_IPC_COMMAND_PREFIX => '%%%___VIMPUT___%%%: '; use constant CTRL_X => 24; @@ -54,10 +53,9 @@ sub open_tmux_split { sub update_input_line_when_finished { - my ($read_handle, $write_handle, $command_handle, $fuckface); + my ($read_handle, $write_handle); pipe($read_handle, $write_handle); - pipe($fuckface, $command_handle); my $pid = fork(); @@ -65,14 +63,11 @@ sub update_input_line_when_finished { print "Failed to fork: $!"; # TODO: Irssi print close $read_handle; close $write_handle; - close $command_handle; - close $fuckface; return; } if ($pid == 0) { my $fifo_path = tmpnam(); - close $command_handle; open_tmux_split($fifo_path); @@ -93,7 +88,6 @@ if ($pid == 0) { } else { close $write_handle; - close $command_handle; Irssi::pidwait_add($pid); @@ -105,14 +99,6 @@ else { \&pipe_input, \@args, ); - my $p2; - my @ar2 = ($fuckface, \$p2); - $p2 = Irssi::input_add( - fileno $fuckface, - Irssi::INPUT_READ, - \&pipe_open_tmux_split, - \@ar2, - ); } } @@ -133,21 +119,6 @@ sub pipe_input { } -sub pipe_open_tmux_split { - my ($args) = @_; - my ($read_handle, $pipe_tag) = @$args; - - my $fifo_path = <$read_handle>; - - # open_tmux_split('rando', $fifo_path); - - # TODO: Add $forked to not spawn more than one children unnecessarily - - close $read_handle; - Irssi::input_remove($$pipe_tag); -} - - # TODO: Find out if it's possible to do this is a command Irssi::signal_add_last 'gui key pressed' => sub { my ($key) = @_; -- cgit v1.2.3