gopkg.in/openshift/source-to-image.v1@v1.2.0/hack/windows/sigintwrap/README.md (about)

     1  sigintwrap is an executable wrapper used in the automated testing of s2i on
     2  Windows.  In hack/test-stirunimage.sh it is verified that sending an interrupt
     3  to a running s2i process (i.e. sending a SIGINT on Linux, or specifically
     4  pressing CTRL+C or CTRL+BREAK on Windows) causes the process to clean up a
     5  running Docker container before exiting.
     6  
     7  Cygwin is used for Windows build and testing of s2i, but note that the s2i
     8  binary itself has no dependency on Cygwin (in general, Go and the executables it
     9  compiles have no knowledge or dependency on Cygwin).
    10  
    11  For the above test to be valid and succeed on Windows, it is necessary to bridge
    12  between receiving the SIGINT sent by the test framework (note: on Windows,
    13  POSIX-style signal handling is implemented only in Cygwin-compiled/-aware
    14  executables, in userspace) and Golang acting on a native CTRL+C/CTRL+BREAK
    15  event.
    16  
    17  sigintwrap is a Cygwin-compiled executable which spawns a named executable in a
    18  new Windows process group and waits until it exits.  If before that time
    19  sigintwrap receives a SIGINT signal it sends a synthetic CTRL+BREAK event to the
    20  process it started.
    21  
    22  This approach is used (rather than, say, simply using the
    23  GenerateConsoleCtrlEvent API directly to create a synthetic event) because there
    24  is no obvious and straightforward way to spawn a new process into a new Windows
    25  process group in Cygwin without resorting to C, nor is there an obvious free
    26  lightweight pre-existing utility which can be used to send a synthetic
    27  CTRL+BREAK event to a given process.