Neovim: sockconnect: add support for connecting to FIFO

Created on 8 Jan 2019  路  3Comments  路  Source: neovim/neovim

  • nvim --version: 0.3.2
  • Vim (version: ) behaves differently? N/A
  • Operating system/version: macOS 10.13.6
  • Terminal name/version: Kitty 0.13.2
  • $TERM: screen-256color

Steps to reproduce using nvim -u NORC

1) mkfifo /tmp/myfifo
2) Open nvim -u NORC test.vim and save the buffer
3) Copy the following script and the source the buffer

function! s:OnData(id, data, event)
    echo join(a:data, '\n')
endfunction

let id = sockconnect('pipe', '/tmp/myfifo', { 'on_data': function('s:OnData') })

The pipe works as expected when running the following from a shell.

echo "hello" > /tmp/myfifo &
cat /tmp/myfifo

Actual behaviour

Neovim throws this error: connection failed: connection refused

Expected behaviour

Be able to connect to the named pipe.

channel enhancement help wanted

Most helpful comment

I think sockconnect() on non-RPC pipes doesn't work yet.

@justinmk It does, by virtue of just using a shared code path for TCP sockets and named pipes. Why would we do otherwise? How does a _flaky_ test indicate missing functionality? (How could the test ever be written in the first place, if the functionality didn't exist?)

mkfifo makes a FIFO object, not a named pipe. We could support it, but that would require separate code, as it is unidirectional, and we would connect to either the reading or writing end specifically.

All 3 comments

I think sockconnect() on non-RPC pipes doesn't work yet. e3c4c8a90e04316d1290729f6952a89ea2733cb6

But it should work with a TCP socket.

I think sockconnect() on non-RPC pipes doesn't work yet.

@justinmk It does, by virtue of just using a shared code path for TCP sockets and named pipes. Why would we do otherwise? How does a _flaky_ test indicate missing functionality? (How could the test ever be written in the first place, if the functionality didn't exist?)

mkfifo makes a FIFO object, not a named pipe. We could support it, but that would require separate code, as it is unidirectional, and we would connect to either the reading or writing end specifically.

Thanks for the clarification!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Shougo picture Shougo  路  3Comments

jbaiter picture jbaiter  路  3Comments

justinmk picture justinmk  路  3Comments

DanySpin97 picture DanySpin97  路  3Comments

nhooyr picture nhooyr  路  3Comments