Skip to content
  • Iustin Pop's avatar
    Change daemon.GenericMain/utils.Daemonize workflow · b78aa8c2
    Iustin Pop authored
    
    
    This patch copies the pipe-based error reporting functionality from
    utils.StartDaemon (I gave up for now on tryin to merge the two).
    
    This patch will fix two longstanding bugs:
    
    - if we fork, we lose all error reporting from the child to the original
      parent
    - if we fork, the original parent exits before the child is ready to
      "work" (whatever the work might be)
    
    Both these are fixed once the users of daemon.GenericMain are converted
    to the three-state setup, as we'll get error reporting via the pipe and
    also not exit until the PrepFn is done.
    
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
    b78aa8c2