diff options
| author | Teddy Wing | 2017-12-16 21:38:21 +0100 |
|---|---|---|
| committer | Teddy Wing | 2017-12-16 21:40:44 +0100 |
| commit | 84ff19af19f6ca44c658bf4fb0f3e9d0214ae8f0 (patch) | |
| tree | e06fe354187a5ff19ebe724314dc7a7d5948015b /vimput.pl | |
| parent | 471af2ce8aa3e152336761b2c618f673f2c0adf8 (diff) | |
| download | irssi-vimput-84ff19af19f6ca44c658bf4fb0f3e9d0214ae8f0.tar.bz2 | |
Open Vim instance without blocking
I tried to open the Vim instance in `pipe_open_tmux_split`, but this
gave me the same problems as before with Vim not able to write to the
pipe. This was because the main Irssi process was blocked on the `open`
and wasn't reading from the pipe.
The mistake was opening Vim from the parent Irssi. Instead, open it from
the child fork so we don't block the parent and all is good. We can open
Vim and correctly save to the pipe. Yeah!
Diffstat (limited to 'vimput.pl')
| -rw-r--r-- | vimput.pl | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -185,9 +185,11 @@ if ($pid == 0) { # my $fifo_path = "$tempdir/fifo"; # print $write_handle VIMPUT_IPC_COMMAND_PREFIX . $fifo_path; - print $command_handle VIMPUT_IPC_COMMAND_PREFIX . $fifo_path; + # print $command_handle $fifo_path; close $command_handle; + open_tmux_split('rando', $fifo_path); + mkfifo($fifo_path, 0600) or die $!; open my $fifo, '<', $fifo_path or die $!; @@ -267,9 +269,9 @@ sub pipe_open_tmux_split { my ($args) = @_; my ($read_handle, $pipe_tag) = @$args; - my $input = <$read_handle>; + my $fifo_path = <$read_handle>; - print 'C: ' . $input; + # open_tmux_split('rando', $fifo_path); # TODO: Add $forked to not spawn more than one children unnecessarily |
