go-daemon
go-daemon copied to clipboard
allow a way for the child to communicate with the parent
and vice versa. Possibly by just using a pipe?
looks like there's already a pipe but it's closed before control is returned to the application. Possibly just need an option to not close the pipe
@kahing Thank you for the request. Please explain what scenario do you want to implement? It is possible to extend Context with a binary data which will be transferred to the child on the start. The library use a unnamed pipe to transfer context to the child but there is no a way to use the pipe after terminating of the parent's process because the pipe is closed automatically by OS (on parent's side). If you want sometimes to connect to the child and send complex commands, we can use Named Pipe, i think. For simple commands is better to use System Signals.
The use case is the parent want to wait for the child to potentially show errors to the user. I currently use signals as you can see in https://github.com/kahing/goofys/commit/eb7963e9fb33235d5650ee0f634902cffdded573 . However things like error messages are lost. I could use the logfile mechanism but that seems kind of overkill for just one error message.
Ok, i think i understood you. I have an idea how to implement it.
Would like to know how this issue is going... A pipe is also a good solution, if not the best, when the parent process wants to pass some credentials to its child.