@fredlackey/devutils 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils/common/shell.js +22 -1
package/package.json
CHANGED
|
@@ -124,11 +124,32 @@ function which(executable) {
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* Checks if a command is available in PATH
|
|
127
|
+
*
|
|
128
|
+
* On Windows, this also handles App Execution Aliases (used by winget, etc.)
|
|
129
|
+
* which are special reparse points that don't appear as regular files to
|
|
130
|
+
* fs.statSync().isFile(). We fall back to using the 'where' command for these.
|
|
131
|
+
*
|
|
127
132
|
* @param {string} command - The command to check
|
|
128
133
|
* @returns {boolean}
|
|
129
134
|
*/
|
|
130
135
|
function commandExists(command) {
|
|
131
|
-
|
|
136
|
+
// First try the file-based check (works for regular executables)
|
|
137
|
+
if (which(command) !== null) {
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// On Windows, App Execution Aliases (like winget) don't appear as regular
|
|
142
|
+
// files to fs.statSync(). Use 'where' command as a fallback.
|
|
143
|
+
if (process.platform === 'win32') {
|
|
144
|
+
try {
|
|
145
|
+
cpExecSync(`where ${command}`, { stdio: 'ignore' });
|
|
146
|
+
return true;
|
|
147
|
+
} catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return false;
|
|
132
153
|
}
|
|
133
154
|
|
|
134
155
|
/**
|