blob: 4957ee656d5760c9cee315fa45969e636ce05d83 [file] [log] [blame]
Caleb Rouleau6844df152019-09-11 01:11:591#!/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
6"""Script for use in test_env unittests."""
7
Chris McDonaldc3e0f26b2020-06-04 02:15:148from __future__ import print_function
Caleb Rouleau6844df152019-09-11 01:11:599import signal
10import sys
11import time
12
13
Chris McDonaldc3e0f26b2020-06-04 02:15:1414def print_signal(sig, *_args):
15 print('Signal :{}'.format(sig))
Caleb Rouleau6844df152019-09-11 01:11:5916
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)
23 time.sleep(2) # gives process time to receive signal.