get rid of forceQuitInstruments (fix #2901)

This commit is contained in:
Jonathan Lipps
2014-06-19 11:24:42 -07:00
parent d2b5ae9853
commit 4777fa3ca7
5 changed files with 1 additions and 81 deletions

View File

@@ -32,7 +32,6 @@ All flags are optional, but some are required in conjunction with certain others
|`--log-no-colors`|false|Don't use colors in console output||
|`-G`, `--webhook`|null|Also send log output to this HTTP listener|`--webhook localhost:9876`|
|`--native-instruments-lib`|false|(IOS-only) IOS has a weird built-in unavoidable delay. We patch this in appium. If you do not want it patched, pass in this flag.||
|`--force-quit-instruments`, `-fqi`|false|Run the watcher process that will force-kill an unresponsive instruments||
|`--app-pkg`|null|(Android-only) Java package of the Android app you want to run (e.g., com.example.android.myApp)|`--app-pkg com.example.android.myApp`|
|`--app-activity`|null|(Android-only) Activity name for the Android activity you want to launch from your package (e.g., MainActivity)|`--app-activity MainActivity`|
|`--app-wait-package`|false|(Android-only) Package name for the Android activity you want to wait for (e.g., com.example.android.myApp)|`--app-wait-package com.example.android.myApp`|

View File

@@ -1,68 +1,13 @@
"use strict";
var helpers = require('../helpers.js')
, isWindows = helpers.isWindows()
, isMac = helpers.isMac()
, iosConfigured = helpers.iosConfigured
, macVersionArray = helpers.macVersionArray
, _ = require("underscore")
, exec = require('child_process').exec
, spawn = require('child_process').spawn
, path = require('path')
, endInstrumentsPath = path.resolve(__dirname, '../../build/force_quit/ForceQuitUnresponsiveApps.app/Contents/MacOS/ForceQuitUnresponsiveApps')
var _ = require("underscore")
, gridRegister = require('./grid-register.js')
, logger = require('./logger.js').get('appium')
, status = require('./status.js')
, async = require('async')
, through = require('through')
, io = require('socket.io')
, mkdirp = require('mkdirp')
, bytes = require('bytes');
var watchForUnresponsiveInstruments = function (cb) {
if (isWindows) return;
var endOldProcess = function (cb) {
exec("killall -9 ForceQuitUnresponsiveApps", { maxBuffer: 524288 }, function () { cb(); });
};
var cleanLogs = function (data) {
var re = /[0-9\-:. ]+ForceQuitUnresponsiveApps\[[0-9:]+\] /g;
return data.replace(re, '');
};
var startNewprocess = function (cb) {
logger.debug("Spawning instruments force-quitting watcher process");
var process = spawn(endInstrumentsPath);
process.stdout.setEncoding('utf8');
process.stderr.setEncoding('utf8');
process.stderr.pipe(through(function (data) {
logger.debug('[FQInstruments STDERR] ' + cleanLogs(data.trim()));
}));
process.stdout.pipe(through(function (data) {
logger.debug('[FQInstruments] ' + cleanLogs(data.trim()));
}));
cb();
};
macVersionArray(function (err, versions) {
if (err) return cb(err);
if (versions[1] >= 9) {
async.series([
endOldProcess,
startNewprocess
], cb);
} else {
logger.debug("Not spawning instruments force-quit watcher since it " +
"only works on 10.9 and you have " + versions.join("."));
cb();
}
});
};
module.exports.allowCrossDomain = function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,POST,PUT,OPTIONS,DELETE');
@@ -218,9 +163,6 @@ var getNonDefaultArgs = function (parser, args) {
module.exports.startListening = function (server, args, parser, appiumVer, appiumRev, appiumServer, cb) {
var alreadyReturned = false;
server.listen(args.port, args.address, function () {
if (isMac && iosConfigured() && args.forceQuitInstruments) {
watchForUnresponsiveInstruments(function () {});
}
var welcome = "Welcome to Appium v" + appiumVer;
if (appiumRev) {
welcome += " (REV " + appiumRev + ")";

View File

@@ -191,16 +191,6 @@ var args = [
, nargs: 0
}],
[['--force-quit-instruments', '-fqi'], {
defaultValue: false
, dest: 'forceQuitInstruments'
, action: 'storeTrue'
, required: false
, help: "Run the watcher process that will force-kill an " +
"unresponsive instruments"
, nargs: 0
}],
[['--app-pkg'], {
dest: 'androidPackage'
, defaultValue: null

View File

@@ -154,16 +154,6 @@ reset_ios() {
echo "* Installing ios-sim-locale"
run_cmd rm -f build/ios-sim-locale
run_cmd cp assets/ios-sim-locale build/ios-sim-locale
echo "* Cloning/updating ForceQuitUnresponsiveApps"
run_cmd git submodule update --init submodules/ForceQuitUnresponsiveApps
echo "* Building ForceQuitUnresponsiveApps"
run_cmd pushd submodules/ForceQuitUnresponsiveApps
run_cmd ./build_force_quit.sh
run_cmd popd
echo "* Moving ForceQuitUnresponsiveApps into build/force_quit"
run_cmd rm -rf build/force_quit
run_cmd mkdir build/force_quit
run_cmd cp -R submodules/ForceQuitUnresponsiveApps/bin/* build/force_quit
echo "* Cloning/updating udidetect"
run_cmd git submodule update --init submodules/udidetect
echo "* Building udidetect"