raphinesse commented on a change in pull request #763: refactor: replace 
superspawn & child_process with execa
URL: https://github.com/apache/cordova-ios/pull/763#discussion_r364462704
 
 

 ##########
 File path: bin/templates/scripts/cordova/lib/versions.js
 ##########
 @@ -19,73 +19,55 @@
     under the License.
 */
 
-const child_process = require('child_process');
 const Q = require('q');
+const execa = require('execa');
 const semver = require('semver');
 
-exports.get_apple_ios_version = () => {
-    const d = Q.defer();
-    child_process.exec('xcodebuild -showsdks', (error, stdout, stderr) => {
-        if (error) {
-            d.reject(stderr);
-        } else {
-            d.resolve(stdout);
-        }
-    });
-
-    return d.promise.then(output => {
-        const regex = /[0-9]*\.[0-9]*/;
-        const versions = [];
-        const regexIOS = /^iOS \d+/;
-        output = output.split('\n');
-        for (let i = 0; i < output.length; i++) {
-            if (output[i].trim().match(regexIOS)) {
-                versions[versions.length] = 
parseFloat(output[i].match(regex)[0]);
+function fetchSdkVersionByType (sdkType) {
+    return execa('xcodebuild', ['-showsdks'])
+        .then(
+            ({ stdout }) => stdout,
+            ({ stderr }) => stderr
 
 Review comment:
   ```suggestion
               ({ stderr }) => Promise.reject(stderr)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to