[ https://issues.apache.org/jira/browse/CB-13581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16509145#comment-16509145 ]
ASF GitHub Bot commented on CB-13581: ------------------------------------- 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: us...@infra.apache.org > Cordova plugin after_run hook terminates before promise is resolved > ------------------------------------------------------------------- > > Key: CB-13581 > URL: https://issues.apache.org/jira/browse/CB-13581 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-cli, cordova-plugins > Affects Versions: 7.0.0 > Environment: Running Cordova 7.1.0 on macOS Sierra 10.12.6 > Reporter: Niklas Kirk Mouritzsen > Priority: Blocker > Labels: hooks, plugin > Original Estimate: 3h > Remaining Estimate: 3h > > When creating a plugin that hooks itself up on the after_run hook, its is > terminated before the promise is resolved or rejected. It is currently > blocking our development. I've created this post on stack overflow describing > the problem in greater detail: > https://stackoverflow.com/questions/47288569/cordova-plugin-asynchronous-hooks-not-working > Let me know if I can provide any additional insight in the problem, or if > there are any known workarounds/fixes for this. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org