Commit 96519364 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[tools] Properly handle sigterm in gcmole

Bug: chromium:706763
Change-Id: Iac91fa538ed61d1c47509f990ee9426b0b3bdc1d
Reviewed-on: https://chromium-review.googlesource.com/467147Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44401}
parent e55461a8
......@@ -4,6 +4,7 @@
# found in the LICENSE file.
import os
import signal
import subprocess
import sys
......@@ -16,8 +17,19 @@ BASE_PATH = os.path.dirname(os.path.dirname(GCMOLE_PATH))
assert len(sys.argv) == 2
sys.exit(subprocess.call(
proc = subprocess.Popen(
[LUA, DRIVER, sys.argv[1]],
env={'CLANG_BIN': CLANG_BIN, 'CLANG_PLUGINS': CLANG_PLUGINS},
cwd=BASE_PATH,
))
)
def handle_sigterm(*args):
try:
proc.kill()
except OSError:
pass
signal.signal(signal.SIGTERM, handle_sigterm)
proc.communicate()
sys.exit(proc.returncode)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment