MCPcopy Index your code
hub / github.com/nodejs/node / Execute

Function Execute

tools/test.py:770–837  ·  view source on GitHub ↗
(args, context, timeout=None, env=None, disable_core_files=False,
            stdin=None, max_virtual_memory=None)

Source from the content-addressed store, hash-verified

768 break
769
770def Execute(args, context, timeout=None, env=None, disable_core_files=False,
771 stdin=None, max_virtual_memory=None):
772 (fd_out, outname) = tempfile.mkstemp()
773 (fd_err, errname) = tempfile.mkstemp()
774
775 if env is None:
776 env = {}
777 env_copy = os.environ.copy()
778
779 # Remove NODE_PATH
780 if "NODE_PATH" in env_copy:
781 del env_copy["NODE_PATH"]
782
783 # Remove NODE_REPL_EXTERNAL_MODULE
784 if "NODE_REPL_EXTERNAL_MODULE" in env_copy:
785 del env_copy["NODE_REPL_EXTERNAL_MODULE"]
786
787 # Extend environment
788 for key, value in env.items():
789 env_copy[key] = value
790
791 # We append NODE_SKIP_FLAG_CHECK (ref: test/common/index.js)
792 # to avoid parsing the test files twice when looking for
793 # flags or environment variables defined via // Flags: and // Env:
794 env_copy["NODE_SKIP_FLAG_CHECK"] = "true"
795
796 preexec_fn = None
797
798 def disableCoreFiles():
799 import resource
800 resource.setrlimit(resource.RLIMIT_CORE, (0,0))
801
802 if disable_core_files and not utils.IsWindows():
803 preexec_fn = disableCoreFiles
804
805 if max_virtual_memory is not None and utils.GuessOS() == 'linux':
806 def setMaxVirtualMemory():
807 import resource
808 resource.setrlimit(resource.RLIMIT_CORE, (0,0))
809 resource.setrlimit(resource.RLIMIT_AS, (max_virtual_memory,max_virtual_memory + 1))
810
811 if preexec_fn is not None:
812 prev_preexec_fn = preexec_fn
813 def setResourceLimits():
814 setMaxVirtualMemory()
815 prev_preexec_fn()
816 preexec_fn = setResourceLimits
817 else:
818 preexec_fn = setMaxVirtualMemory
819
820 (_process, exit_code, timed_out) = RunProcess(
821 context,
822 timeout,
823 args = args,
824 stdin = stdin,
825 stdout = fd_out,
826 stderr = fd_err,
827 env = env_copy,

Callers 5

RunCommandMethod · 0.70
get_env_typeFunction · 0.70
get_asan_stateFunction · 0.70
MainFunction · 0.70

Calls 8

RunProcessFunction · 0.85
CheckedUnlinkFunction · 0.85
CommandOutputClass · 0.85
copyMethod · 0.65
closeMethod · 0.65
openFunction · 0.50
itemsMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…