github.com/portworx/docker@v1.12.1/daemon/monitor_windows.go (about)

     1  package daemon
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/docker/docker/container"
     7  	"github.com/docker/docker/libcontainerd"
     8  )
     9  
    10  // platformConstructExitStatus returns a platform specific exit status structure
    11  func platformConstructExitStatus(e libcontainerd.StateInfo) *container.ExitStatus {
    12  	return &container.ExitStatus{
    13  		ExitCode: int(e.ExitCode),
    14  	}
    15  }
    16  
    17  // postRunProcessing perfoms any processing needed on the container after it has stopped.
    18  func (daemon *Daemon) postRunProcessing(container *container.Container, e libcontainerd.StateInfo) error {
    19  	if e.ExitCode == 0 && e.UpdatePending {
    20  		spec, err := daemon.createSpec(container)
    21  		if err != nil {
    22  			return err
    23  		}
    24  
    25  		servicingOption := &libcontainerd.ServicingOption{
    26  			IsServicing: true,
    27  		}
    28  
    29  		// Create a new servicing container, which will start, complete the update, and merge back the
    30  		// results if it succeeded, all as part of the below function call.
    31  		if err := daemon.containerd.Create((container.ID + "_servicing"), *spec, servicingOption); err != nil {
    32  			container.SetExitCode(-1)
    33  			return fmt.Errorf("Post-run update servicing failed: %s", err)
    34  		}
    35  	}
    36  	return nil
    37  }