diff --git a/tools/gyp_node.py b/tools/gyp_node.py index 831d2ef1550cdb..333c89f5ae9f5a 100755 --- a/tools/gyp_node.py +++ b/tools/gyp_node.py @@ -51,6 +51,12 @@ def run_gyp(args): args.append('-Dlinux_use_bundled_gold=0') args.append('-Dlinux_use_gold_flags=0') + # Set the current program to this module. This is done because gyp + # will use the program path in targets it generates. If this script was called + # by another script the program name will not be gyp_node.py but whatever + # the name of the script that called it is, leading to incorrect commands + # in generated targets (for example cmd_regen_makefile). + sys.argv[0] = os.path.abspath(__file__) rc = gyp.main(args) if rc != 0: print('Error running GYP')