import signal
import sys
from threading import Event

def GetInterruptEvent():
    e = Event()

    def signal_handler(signal, frame):
        print('You pressed Ctrl+C!')
        e.set()

    signal.signal(signal.SIGINT, signal_handler)

    return e

import signal
import sys
from threading import Event

def GetInterruptEvent():
    e = Event()

    def signal_handler(signal, frame):
        print('You pressed Ctrl+C!')
        e.set()

    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)

    return e

Handle sigterm as well as sigint.
Handle sigterm as well as sigint.

  import signal
  import sys
  from threading import Event
  
  def GetInterruptEvent():
      e = Event()
  
      def signal_handler(signal, frame):
          print('You pressed Ctrl+C!')
          e.set()
  
      signal.signal(signal.SIGINT, signal_handler)
+     signal.signal(signal.SIGTERM, signal_handler)
  
      return e
  
Handle sigterm as well as sigint.
## Code Before:
import signal
import sys
from threading import Event

def GetInterruptEvent():
    e = Event()

    def signal_handler(signal, frame):
        print('You pressed Ctrl+C!')
        e.set()

    signal.signal(signal.SIGINT, signal_handler)

    return e

## Instruction:
Handle sigterm as well as sigint.
## Code After:
import signal
import sys
from threading import Event

def GetInterruptEvent():
    e = Event()

    def signal_handler(signal, frame):
        print('You pressed Ctrl+C!')
        e.set()

    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)

    return e
