1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | exports.spawnSudoAsync = exports.getPossibleProjectRoot = void 0;
|
7 | const spawn_async_1 = __importDefault(require("@expo/spawn-async"));
|
8 | const fs_1 = require("fs");
|
9 | const sudo_prompt_1 = __importDefault(require("sudo-prompt"));
|
10 | function getPossibleProjectRoot() {
|
11 | return fs_1.realpathSync(process.cwd());
|
12 | }
|
13 | exports.getPossibleProjectRoot = getPossibleProjectRoot;
|
14 | async function spawnSudoAsync(command, spawnOptions) {
|
15 |
|
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 |
|
28 |
|
29 | console.log('Your password might be needed to install CocoaPods CLI: https://guides.cocoapods.org/using/getting-started.html#installation');
|
30 | await spawn_async_1.default('sudo', command, spawnOptions);
|
31 | }
|
32 | }
|
33 | exports.spawnSudoAsync = spawnSudoAsync;
|
34 |
|
\ | No newline at end of file |