1#!/usr/bin/env python3 2# Copyright 2014 the V8 project 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 6"""This program wraps an arbitrary command since gn currently can only execute 7scripts.""" 8 9import subprocess 10import sys 11 12result = subprocess.call(sys.argv[1:]) 13if result != 0: 14 # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier 15 # to recognize and differentiate in hex. 16 if result < -100: 17 # Print negative hex numbers as positive by adding 2^32. 18 print('Return code is %08X' % (result + 2**32)) 19 else: 20 print('Return code is %d' % result) 21sys.exit(result) 22