Closed vbauerster closed 3 years ago
It looks macOS doesn’t have setsid
.
Can you try to create a session named test
with the following code:
crystal eval <<EOF
lib C
fun setsid
end
Process.fork do
C.setsid
Process.run("kak", { "-s", "test", "-d" })
end
EOF
The server should survive closing the terminal.
See C bindings for reference.
It looks macOS doesn’t have
setsid
.
You're right, there is no such executable in mac.
kak -l
shows nothing, after invoking the snippet with C bindings.
According to the manual, the signature for setsid()
is:
pid_t setsid(void);
Does it work better if you update with:
lib C
fun setsid : Int32
end
Try also to replace Process.run
with Process.new
if it changes something. Normally no, as it runs in the background anyway.
Apparently, we should double fork to orphan the server, like in fork_server_to_background()
.
lib C
fun setsid : Int32
end
class Process
def self.setsid(command, arguments)
fork do
C.setsid
# Double fork to orphan the server.
fork do
new(command, arguments)
end
end
end
end
Process.setsid("kak", { "-s", "test", "-d" })
Thank you! I confirm that's been fixed.
Invoking
kcr shell --session test
on mac raises exception: