mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
signals: support detach and notify socket together
let runc run until READY= is received and then proceed with detaching the process. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
+11
-2
@@ -51,16 +51,25 @@ type signalHandler struct {
|
||||
|
||||
// forward handles the main signal event loop forwarding, resizing, or reaping depending
|
||||
// on the signal received.
|
||||
func (h *signalHandler) forward(process *libcontainer.Process, tty *tty) (int, error) {
|
||||
func (h *signalHandler) forward(process *libcontainer.Process, tty *tty, detach bool) (int, error) {
|
||||
// make sure we know the pid of our main process so that we can return
|
||||
// after it dies.
|
||||
if detach && h.notifySocket == nil {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
pid1, err := process.Pid()
|
||||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
|
||||
if h.notifySocket != nil {
|
||||
go h.notifySocket.run()
|
||||
if detach {
|
||||
h.notifySocket.run(pid1)
|
||||
return 0, nil
|
||||
} else {
|
||||
go h.notifySocket.run(0)
|
||||
}
|
||||
}
|
||||
|
||||
// perform the initial tty resize.
|
||||
|
||||
Reference in New Issue
Block a user