MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / execute2

Function execute2

src/commoncode/command.py:123–154  ·  view source on GitHub ↗

Run a `cmd_loc` command with the `args` arguments list and return the return code, the stdout and stderr. DEPRECATED: DO NOT USE. Use execute() instead To avoid RAM exhaustion, always write stdout and stderr streams to files. If `to_files` is False, return the content of stder

(
    cmd_loc,
    args,
    lib_dir=None,
    cwd=None,
    env=None,
    to_files=False,
    log=TRACE,
)

Source from the content-addressed store, hash-verified

121
122
123def execute2(
124 cmd_loc,
125 args,
126 lib_dir=None,
127 cwd=None,
128 env=None,
129 to_files=False,
130 log=TRACE,
131):
132 """
133 Run a `cmd_loc` command with the `args` arguments list and return the return
134 code, the stdout and stderr.
135 DEPRECATED: DO NOT USE. Use execute() instead
136
137 To avoid RAM exhaustion, always write stdout and stderr streams to files.
138
139 If `to_files` is False, return the content of stderr and stdout as ASCII
140 strings. Otherwise, return the locations to the stderr and stdout temporary
141 files.
142
143 Run the command using the `cwd` current working directory with an `env` dict
144 of environment variables.
145 """
146 import warnings
147
148 warnings.warn(
149 "commoncode.command.execute2 is deprecated. Use execute() instead.",
150 DeprecationWarning,
151 stacklevel=2,
152 )
153
154 return execute(cmd_loc, args, cwd, env, to_files, log)
155
156
157def get_env(base_vars=None, lib_dir=None):

Callers

nothing calls this directly

Calls 1

executeFunction · 0.85

Tested by

no test coverage detected