blob: bef10ab170bd90c75c2d37152733fa038cc9eaee [file] [log] [blame]
Ben Segalleb2866e2023-01-20 20:14:44 +00001#!/usr/bin/env python3
2# Copyright 2023 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"""This script is a wrapper around the ninja.py script that also
6handles the client lifecycle safely. It will automatically start
7reproxy before running ninja and stop reproxy when ninja stops
8for any reason eg. build completes, keyboard interupt etc."""
9
Ben Segalleb2866e2023-01-20 20:14:44 +000010import sys
11
12import ninja
Junji Watanabe607284d2023-04-20 03:14:52 +000013import reclient_helper
Ben Segallc4efd8a2023-02-13 17:17:33 +000014
15
Ben Segalleb2866e2023-01-20 20:14:44 +000016def main(argv):
Junji Watanabe607284d2023-04-20 03:14:52 +000017 with reclient_helper.build_context(argv) as ret_code:
18 if ret_code:
19 return ret_code
20 try:
21 return ninja.main(argv)
22 except KeyboardInterrupt:
23 return 1
Ben Segalleb2866e2023-01-20 20:14:44 +000024
25
26if __name__ == '__main__':
27 sys.exit(main(sys.argv))