0
Files
src/testing/test_env_test_script.py
Chris McDonald c3e0f26bef Make test_env compatible with python 2 & 3
Use the vendored copy of the `six` library to make this code work across
Python versions.

Bug: 942720
Change-Id: I4bdb1032ed8e89e733b929eb13ada54efeb3b019
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2229335
Commit-Queue: Chris McDonald <cjmcdonald@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774934}
2020-06-04 02:15:14 +00:00

24 lines
632 B
Python
Executable File

#!/usr/bin/env python
# Copyright (c) 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script for use in test_env unittests."""
from __future__ import print_function
import signal
import sys
import time
def print_signal(sig, *_args):
print('Signal :{}'.format(sig))
if __name__ == '__main__':
signal.signal(signal.SIGTERM, print_signal)
signal.signal(signal.SIGINT, print_signal)
if sys.platform == 'win32':
signal.signal(signal.SIGBREAK, print_signal)
time.sleep(2) # gives process time to receive signal.