Skip to content

Creating two handles from unix socket not working #7

@osa1

Description

@osa1

I'm trying to debug why plugins don't work. I added lots of logging prints and apparently we're not getting any messages at all. While trying to debug, I found this:

> e <- attach' "/tmp/nvimHeJ6f9/0" 
> runNeovim  e () (vim_get_buffers)
^CInterrupted.
> e <- attach "/tmp/nvimHeJ6f9/0" 
> runNeovim  e () (vim_get_buffers)
(Right [Buffer "\STX"],())

Here are attach' and attach:

attach :: FilePath -> IO (ConfigWrapper RPCConfig)
attach sockPath = do
    h <- createHandle ReadWriteMode (UnixSocket sockPath)
    q <- newTQueueIO
    e <- ConfigWrapper q <$> newRPCConfig
    _ <- forkIO $ runSocketReader' h e
    _ <- forkIO $ runEventHandler' h e
    return e

-- | FIXME: This doesn't work!! Use attach!
attach' :: FilePath -> IO (ConfigWrapper RPCConfig)
attach' sockPath = do
    q <- newTQueueIO
    e <- ConfigWrapper q <$> newRPCConfig
    _ <- forkIO $ runSocketReader (UnixSocket sockPath) e
    _ <- forkIO $ runEventHandler (UnixSocket sockPath) e
    return e

However, fixing this doesn't solve the issue. I'm still trying to debug and will close this issue with my PR that fixes plugins.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions