From 5538c3f63eaca61c54566dd1b0efbf36a8ba012a Mon Sep 17 00:00:00 2001 From: jonalter Date: Fri, 17 Apr 2015 07:19:36 -0700 Subject: [PATCH] [TIMOB-18633] Adding args for launching WatchKit apps --- lib/simulator.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/simulator.js b/lib/simulator.js index 6d75175..3e3f38f 100644 --- a/lib/simulator.js +++ b/lib/simulator.js @@ -410,13 +410,31 @@ function launch(udid, options, callback) { var existingCrashes = getCrashes(), timeout = Math.max(options.timeout || 180, 1), // default of 180 seconds, minimum of 1 seconds args = simHandle.cmd.slice(1).map(function (p) { - return p === '' ? (options.appPath || '') : p; - }).concat('--timeout', isNaN(timeout) ? 180 : timeout), - simProcess = spawn(simHandle.cmd[0], args), + return p === '' ? (options.appPath || '') : p; + }).concat('--timeout', isNaN(timeout) ? 180 : timeout), + simProcess, appName = options.appName || (options.appPath ? path.basename(options.appPath) : null), findLogTimer = null, tail; + if (options.launchWatchApp) { + args = args.concat(['--launch-watch-app']); + } + if (options.launchBundleId) { + args = args.concat(['--launch-bundle-id', options.launchBundleId]); + } + if (options.externalDisplayType) { + args = args.concat(['--external-display-type', options.externalDisplayType]); + } + if (options.watchLaunchMode) { + args = args.concat(['--watch-launch-mode', options.watchLaunchMode]); + } + if (options.watchNotificationPayload) { + args = args.concat(['--watch-notification-payload', options.watchNotificationPayload]); + } + + simProcess = spawn(simHandle.cmd[0], args), + emitter.emit('log-debug', __('Executing: %s', simHandle.cmd[0] + ' "' + args.map(function (a) { return a && typeof a === 'string' ? a.replace(/ /g, '\ ') : a; }).join('" "') + '"')); // listen for ios-sim output