test_env_test_script.py 660 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env python
  2. # Copyright (c) 2019 The Chromium Authors. All rights reserved.
  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. from __future__ import print_function
  7. import signal
  8. import sys
  9. import time
  10. def print_signal(sig, *_args):
  11. print('Signal :{}'.format(sig))
  12. if __name__ == '__main__':
  13. signal.signal(signal.SIGTERM, print_signal)
  14. signal.signal(signal.SIGINT, print_signal)
  15. if sys.platform == 'win32':
  16. signal.signal(signal.SIGBREAK, print_signal) # pylint: disable=no-member
  17. time.sleep(2) # gives process time to receive signal.