algomath-extract 1.0.8 → 1.0.9
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/bin/install.js +4 -11
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -365,19 +365,12 @@ const files = fs.readdirSync(sourceDir).filter(f => f.endsWith('.md'));
|
|
|
365
365
|
for (const file of files) {
|
|
366
366
|
const source = path.join(sourceDir, file);
|
|
367
367
|
const dest = path.join(commandDir, file);
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
} catch (e) {
|
|
373
|
-
// If regular copy fails, use sudo
|
|
368
|
+
|
|
369
|
+
// For any install that needs elevated permissions, use sudo
|
|
370
|
+
if (needsElevated && !isWindows) {
|
|
371
|
+
// Use sudo to copy, then fix ownership
|
|
374
372
|
execSync(`sudo cp "${source}" "${dest}"`, { stdio: 'pipe' });
|
|
375
|
-
// Fix ownership after sudo copy
|
|
376
373
|
execSync(`sudo chown $(whoami) "${dest}"`, { stdio: 'pipe' });
|
|
377
|
-
}
|
|
378
|
-
} else if (needsElevated && !isWindows) {
|
|
379
|
-
// Global install with sudo
|
|
380
|
-
execSync(`sudo cp "${source}" "${dest}"`, { stdio: 'pipe' });
|
|
381
374
|
} else {
|
|
382
375
|
fs.copyFileSync(source, dest);
|
|
383
376
|
}
|