kakounedotcom / connect.kak

Connect a program to Kakoune clients

Home Page:https://kakoune.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

connect.kak doesn't work

sucrecacao opened this issue · comments

I have install the connect.kak as explain in the readme.

When launching kak-shell in a terminal, it start a kakoune instance with the following message in the debug:

Error while transfering remote messages: socket read failed: Bad file descriptor
remote client disconnected: -1
accepting connection failed: socket read failed: No such file or directory
remote client connected: 4

Also it echo something in the prompt : 1:93 'connect-set-detach' wrong argument count

When trying to pop a terminal from kakoune I get the following;

Error: 1:1: 'connect-shell' wrong argument count
Error: 1:1: 'connect-terminal' option not found: 'prelude'. Use declare-option first

I do have prelude installed and require-module connect in my kakrc

I think it is a race condition introduced by mawww/kakoune#3618.

connect-shell connects a shell, not a terminal.

Any idea how to fix ?

connect-terminal

Also, there is no prelude option in the source code, it is prelude_path.

I have no idea what you are talking about.
Why would I have prelude instead of prelude_path in my source code ? it is up to date and I didn't edited the source code.

OK I fixed connect-terminal by deleting everything and reinstalling,
bug kak-shell is still buggy: it give me: 1:93 'connect-set-detach' wrong argument count

Just added a wait_for_session function in kak-shell:

wait_for_session() {
  session=$1

  # Wait for session
  # Grep in quiet mode with fixed strings and whole line switches
  while ! kak -l | grep -q -F -x "$session"; do
    continue
  done
}

@lenormf mentioned flock -E but I do not know it.

mawww/kakoune#3618

Let me know if you know a better implementation.

Just added a wait_for_session function in kak-shell:

wait_for_session() {
  session=$1

  # Wait for session
  # Grep in quiet mode with fixed strings and whole line switches
  while ! kak -l | grep -q -F -x "$session"; do
    continue
  done
}

@lenormf mentioned flock -E but I do not know it.

mawww/kakoune#3618

Let me know if you know a better implementation.

I'm really late to the party. But to keep this from eating up your CPU needlessly, you should have a sleep call instead of continue. If you do a small interval like 0.25s or 0.5s it won't make your CPU go into overload and it'll still be low-latency.

Edit: actually, executing kak takes a good amount of time in and of itself, so my suggestion would only be a small improvement.

Thanks for the feedback. I tested with a slight amount of time and it looks reasonable. You can test the difference:

Before

while true; do continue; done

After

while true; do sleep 0.1; done