Fixes phonegap/ios-deploy#80 (re-fix) --detect not showing non-zero exit code when no devices are detected.
When --detect is turned on, --debug is turned on implicitly so you won't get a segmentation fault.
diff --git a/ios-deploy.c b/ios-deploy.c
index 6fc20f5..156d1bf 100644
--- a/ios-deploy.c
+++ b/ios-deploy.c
@@ -16,7 +16,7 @@
#include <netinet/tcp.h>
#include "MobileDevice.h"
-#define APP_VERSION "1.3.1"
+#define APP_VERSION "1.3.2"
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
#define LLDB_SHELL "lldb -s " PREP_CMDS_PATH
/*
@@ -1448,6 +1448,7 @@
if (detect_only) {
printf("[....] Found %s connected through %s.\n", CFStringGetCStringPtr(device_full_name, CFStringGetSystemEncoding()), CFStringGetCStringPtr(device_interface_name, CFStringGetSystemEncoding()));
+ found_device = true;
return;
}
if (device_id != NULL) {
@@ -1609,10 +1610,12 @@
{
if (!debug) {
printf("[....] No more devices found.\n");
- exit(exitcode_error);
}
- else
- {
+
+ if (detect_only && !found_device) {
+ exit(exitcode_error);
+ return;
+ } else {
int mypid = getpid();
if ((parent != 0) && (parent == mypid) && (child != 0))
{
@@ -1630,7 +1633,7 @@
void usage(const char* app) {
printf(
"Usage: %s [OPTION]...\n"
- " -d, --debug launch the app in GDB after installation\n"
+ " -d, --debug launch the app in lldb after installation\n"
" -i, --id <device_id> the id of the device to connect to\n"
" -c, --detect only detect if the device is connected\n"
" -b, --bundle <bundle.app> the path to the app bundle to be installed\n"
@@ -1723,6 +1726,7 @@
break;
case 'c':
detect_only = true;
+ debug = 1;
break;
case 'V':
show_version();
diff --git a/package.json b/package.json
index d872fef..53b15d9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ios-deploy",
- "version": "1.3.1",
+ "version": "1.3.2",
"description": "launch iOS apps iOS devices from the command line (Xcode 6)",
"main": "ios-deploy",
"scripts": {