From 4777fa3ca76a62e154ef90552dc6dcb6503fe24f Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Thu, 19 Jun 2014 11:24:42 -0700 Subject: [PATCH] get rid of forceQuitInstruments (fix #2901) --- docs/en/server-args.md | 1 - lib/server/helpers.js | 60 +--------------------------- lib/server/parser.js | 10 ----- reset.sh | 10 ----- submodules/ForceQuitUnresponsiveApps | 1 - 5 files changed, 1 insertion(+), 81 deletions(-) delete mode 160000 submodules/ForceQuitUnresponsiveApps diff --git a/docs/en/server-args.md b/docs/en/server-args.md index c0bfdc74f..b8f540e71 100644 --- a/docs/en/server-args.md +++ b/docs/en/server-args.md @@ -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`| diff --git a/lib/server/helpers.js b/lib/server/helpers.js index 5e5de05c3..55b002f91 100644 --- a/lib/server/helpers.js +++ b/lib/server/helpers.js @@ -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 + ")"; diff --git a/lib/server/parser.js b/lib/server/parser.js index ab89d129b..78fea85a7 100644 --- a/lib/server/parser.js +++ b/lib/server/parser.js @@ -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 diff --git a/reset.sh b/reset.sh index 9e3ba0d51..4f99b2c63 100755 --- a/reset.sh +++ b/reset.sh @@ -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" diff --git a/submodules/ForceQuitUnresponsiveApps b/submodules/ForceQuitUnresponsiveApps deleted file mode 160000 index adbdf8260..000000000 --- a/submodules/ForceQuitUnresponsiveApps +++ /dev/null @@ -1 +0,0 @@ -Subproject commit adbdf8260e7a767978f6751cfae7c1f466c8791a