Skip to content

Commit

Permalink
CB-13581 open ios simulator by using child_process (apache#366)
Browse files Browse the repository at this point in the history
* open ios simulator by using child_process
* remove unnecessary comment
  • Loading branch information
knight9999 authored and shazron committed Jul 16, 2018
1 parent 46da4bc commit bff9bca
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bin/templates/scripts/cordova/lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit bff9bca

Please sign in to comment.