1"use strict"; 2var __importDefault = (this && this.__importDefault) || function (mod) { 3 return (mod && mod.__esModule) ? mod : { "default": mod }; 4}; 5Object.defineProperty(exports, "__esModule", { value: true }); 6exports.spawnSudoAsync = exports.getPossibleProjectRoot = void 0; 7const spawn_async_1 = __importDefault(require("@expo/spawn-async")); 8const fs_1 = require("fs"); 9const sudo_prompt_1 = __importDefault(require("sudo-prompt")); 10function getPossibleProjectRoot() { 11 return (0, fs_1.realpathSync)(process.cwd()); 12} 13exports.getPossibleProjectRoot = getPossibleProjectRoot; 14async function spawnSudoAsync(command, spawnOptions) { 15 // sudo prompt only seems to work on win32 machines. 16 if (process.platform === 'win32') { 17 return new Promise((resolve, reject) => { 18 sudo_prompt_1.default.exec(command.join(' '), { name: 'pod install' }, (error) => { 19 if (error) { 20 reject(error); 21 } 22 resolve(); 23 }); 24 }); 25 } 26 else { 27 // Attempt to use sudo to run the command on Mac and Linux. 28 // TODO(Bacon): Make a v of sudo-prompt that's win32 only for better bundle size. 29 console.log('Your password might be needed to install CocoaPods CLI: https://guides.cocoapods.org/using/getting-started.html#installation'); 30 await (0, spawn_async_1.default)('sudo', command, spawnOptions); 31 } 32} 33exports.spawnSudoAsync = spawnSudoAsync; 34//# sourceMappingURL=PackageManager.js.map