| # Copyright 2021 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. |
| from dir_paths import node_dir |
| sys.path = [node_dir] + sys.path |
| from node import GetBinaryPath as get_node_binary_path |
| tsc = os.path.join(node_dir, 'node_modules', 'typescript', 'lib', 'tsc.js') |
| def run_tsc_ignore_errors(args): |
| cmd = [get_node_binary_path(), tsc] + args |
| process = subprocess.Popen(cmd, |
| stdout, stderr = process.communicate() |
| # Typecheck errors go in stdout, not stderr. If we see something in stderr, raise an error. |
| raise RuntimeError('tsc \'%s\' failed\n%s' % (' '.join(cmd), stderr)) |
| if __name__ == '__main__': |
| run_tsc_ignore_errors(sys.argv[1:]) |