MCPcopy
hub / github.com/bower/bower / getWindowsCommand

Function getWindowsCommand

lib/util/cmd.js:27–51  ·  view source on GitHub ↗
(command)

Source from the content-addressed store, hash-verified

25}
26
27function getWindowsCommand(command) {
28 var fullCommand;
29 var extension;
30
31 // Do we got the value converted in the cache?
32 if (mout.object.hasOwn(winWhichCache, command)) {
33 return winWhichCache[command];
34 }
35
36 // Use which to retrieve the full command, which puts the extension in the end
37 try {
38 fullCommand = which.sync(command);
39 } catch (err) {
40 return (winWhichCache[command] = command);
41 }
42
43 extension = path.extname(fullCommand).toLowerCase();
44
45 // Does it need to be converted?
46 if (winBatchExtensions.indexOf(extension) === -1) {
47 return (winWhichCache[command] = command);
48 }
49
50 return (winWhichCache[command] = fullCommand);
51}
52
53// Executes a shell command, buffering the stdout and stderr
54// If an error occurs, a meaningful error is generated

Callers 1

executeCmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…