You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/06/12 04:08:33 UTC

[GitHub] knight9999 closed pull request #366: CB-13581 open ios simulator by using child_process

knight9999 closed pull request #366: CB-13581 open ios simulator by using child_process
URL: https://github.com/apache/cordova-ios/pull/366
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bin/templates/scripts/cordova/lib/run.js b/bin/templates/scripts/cordova/lib/run.js
index 3a6246e17..40344a37f 100644
--- a/bin/templates/scripts/cordova/lib/run.js
+++ b/bin/templates/scripts/cordova/lib/run.js
@@ -19,7 +19,7 @@
 
 var Q = require('q');
 var path = require('path');
-var iossim = require('ios-sim');
+var cp = require('child_process');
 var build = require('./build');
 var spawn = require('./spawn');
 var check_reqs = require('./check_reqs');
@@ -197,7 +197,15 @@ function deployToSim (appPath, target) {
 function startSim (appPath, target) {
     var logPath = path.join(cordovaPath, 'console.log');
 
-    return iossim.launch(appPath, 'com.apple.CoreSimulator.SimDeviceType.' + target, logPath, '--exit');
+    return iossimLaunch(appPath, 'com.apple.CoreSimulator.SimDeviceType.' + target, logPath, '--exit');
+}
+
+function iossimLaunch (app_path, devicetypeid, log, exit) {
+    var f = path.resolve(path.dirname(require.resolve('ios-sim')), 'bin', 'ios-sim');
+    var proc = cp.spawn(f, ['launch', app_path, '--devicetypeid', devicetypeid, '--log', log, exit]);
+    proc.stdout.on('data', (data) => {
+        console.log(data.toString());
+    });
 }
 
 function listDevices () {


 

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


With regards,
Apache Git Services

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