CB-12640: better handling of unrecognized commands on windows. removed error checking in emulator image listing when shelling out, as we already defensively dont shell out if the program is not on the PATH / not recognized. added additional test for windows unrecognized command errors for target listing. fixed up spying in a test.

This commit is contained in:
filmaj
2017-04-06 15:08:22 -07:00
parent 6ef2f67ae8
commit e13e15d3e9
4 changed files with 23 additions and 27 deletions
+1 -3
View File
@@ -1,5 +1,3 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -95,7 +93,7 @@ module.exports.list_targets = function() {
// If there's an error, like avdmanager could not be found, we can try
// as a last resort, to run `android`, in case this is a super old
// SDK installation.
if (err && err.code == 'ENOENT') {
if (err && (err.code == 'ENOENT' || (err.stderr && err.stderr.match(/not recognized/)))) {
return module.exports.list_targets_with_android();
} else throw err;
})
+1 -11
View File
@@ -172,17 +172,7 @@ module.exports.list_images_using_android = function() {
*/
module.exports.list_images = function() {
if (forgivingWhichSync('avdmanager')) {
return module.exports.list_images_using_avdmanager()
.catch(function(err) {
// try to use `avdmanager` in case `android` reports it is no longer available.
// this likely means the target machine is using a newer version of
// the android sdk, and possibly `avdmanager` is available.
if (err && err.code == 'ENOENT') {
return module.exports.list_images_using_android();
} else {
throw err;
}
});
return module.exports.list_images_using_avdmanager();
} else if (forgivingWhichSync('android')) {
return module.exports.list_images_using_android();
} else {