[siso] Propagte SIGINT to siso process

siso's signal handler doesn't run as expected with siso/autosiso
wrappers.
This CL sets signal handlers for the Python wrappers to propagate
signals to siso.

Note that Siso immediately exists at the 2nd Ctrl-C.
So developers can stop Siso forcibly when they want.

Bug: b/308734805
Change-Id: Idd8cc1d99931d609cfc3bedfb4c0bb4319cd20b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4996768
Reviewed-by: Fumitoshi Ukai <ukai@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
changes/68/4996768/5
Junji Watanabe 1 year ago committed by LUCI CQ
parent 00777b41d5
commit 9ed72f91a9

@ -62,11 +62,7 @@ def main(argv):
'-project=',
'-reapi_instance=',
] + argv[1:]
try:
return siso.main(argv)
except KeyboardInterrupt:
print("Shutting down reproxy...", file=sys.stderr)
return 1
return siso.main(argv)
if __name__ == '__main__':

@ -8,6 +8,7 @@ binary when run inside a gclient source tree, so users can just type
"siso" on the command line."""
import os
import signal
import subprocess
import sys
@ -15,6 +16,12 @@ import gclient_paths
def main(args):
# Propagate signals to siso process so that it can run cleanup steps.
# Siso will be terminated immediately after the second Ctrl-C.
signal.signal(signal.SIGINT, lambda signum, frame: None)
if not sys.platform.startswith('win'):
signal.signal(signal.SIGTERM, lambda signum, frame: None)
# On Windows the siso.bat script passes along the arguments enclosed in
# double quotes. This prevents multiple levels of parsing of the special '^'
# characters needed when compiling a single file. When this case is
@ -80,7 +87,4 @@ def main(args):
if __name__ == '__main__':
try:
sys.exit(main(sys.argv))
except KeyboardInterrupt:
sys.exit(1)
sys.exit(main(sys.argv))

Loading…
Cancel
Save