xref: /aosp_15_r20/external/cronet/testing/test_env_test_script.py (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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
6"""Script for use in test_env unittests."""
7
8from __future__ import print_function
9import signal
10import sys
11import time
12
13
14def print_signal(sig, *_args):
15  print('Signal :{}'.format(sig))
16
17
18if __name__ == '__main__':
19  signal.signal(signal.SIGTERM, print_signal)
20  signal.signal(signal.SIGINT, print_signal)
21  if sys.platform == 'win32':
22    signal.signal(signal.SIGBREAK, print_signal) # pylint: disable=no-member
23  time.sleep(2)  # gives process time to receive signal.
24