• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright 2019 The Chromium Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5"""Script for use in test_env unittests."""
6
7from __future__ import print_function
8import signal
9import sys
10import time
11
12
13def print_signal(sig, *_args):
14  print('Signal :{}'.format(sig))
15
16
17if __name__ == '__main__':
18  signal.signal(signal.SIGTERM, print_signal)
19  signal.signal(signal.SIGINT, print_signal)
20  if sys.platform == 'win32':
21    signal.signal(signal.SIGBREAK, print_signal)  # pylint: disable=no-member
22  time.sleep(2)  # gives process time to receive signal.
23