I am considering a client server tool for personal usage. The client and
the server would communicate with a domain socket in $HOME, the server
would not need any options to boot, the client would be a command line tool
that would connect, interchange some data and die; and the server would run
indefinitely. The problem: I would like the client to boot the server if it
is not running.
In C, I would do something like this when the connection fails:
- the client opens the server socket.
- the client connects to itself, opens the client socket.
- the client forks.
- the child becomes the server, closes the client socket descriptor,
detaches from tty, manages signals like SIGHUP.
- the parent becomes the client, closes the server socket descriptor.
- the parent eventually dies and the child continues in background.
I don't know how to fork and manage the (file) descriptors in that way in
go. Or if there are higher level solutions without race conditions. I would
prefer to avoid using os/exec.Command() because I would need to know the
path to the executable. I would prefer to avoid the low level syscall
The problem seems hard enough to not implement this feature at all, but I
would like to know the best alternatives in go anyway.
Daniel Fanjul Alcutén
Tools Engineer @Spotify AB
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.