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

Function _FindCommandInPath

tools/gyp/pylib/gyp/MSVSUserFile.py:16–35  ·  view source on GitHub ↗

If there are no slashes in the command given, this function searches the PATH env to find the given command, and converts it to an absolute path. We have to do this because MSVS is looking for an actual file to launch a debugger on, not just a command line. Note that this happens a

(command)

Source from the content-addressed store, hash-verified

14
15
16def _FindCommandInPath(command):
17 """If there are no slashes in the command given, this function
18 searches the PATH env to find the given command, and converts it
19 to an absolute path. We have to do this because MSVS is looking
20 for an actual file to launch a debugger on, not just a command
21 line. Note that this happens at GYP time, so anything needing to
22 be built needs to have a full path."""
23 if "/" in command or "\\" in command:
24 # If the command already has path elements (either relative or
25 # absolute), then assume it is constructed properly.
26 return command
27 else:
28 # Search through the path list and find an existing file that
29 # we can access.
30 paths = os.environ.get("PATH", "").split(os.pathsep)
31 for path in paths:
32 item = os.path.join(path, command)
33 if os.path.isfile(item) and os.access(item, os.X_OK):
34 return item
35 return command
36
37
38def _QuoteWin32CommandLineArgs(args):

Callers 1

AddDebugSettingsMethod · 0.85

Calls 4

getMethod · 0.65
splitMethod · 0.45
joinMethod · 0.45
accessMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…