Skip to content

Commit

Permalink
Fixes #80 (re-fix) --detect not showing non-zero exit code when no de…
Browse files Browse the repository at this point in the history
…vices are detected.

When --detect is turned on, --debug is turned on implicitly so you won't get a segmentation fault.
  • Loading branch information
shazron committed Nov 17, 2014
1 parent 7c9af71 commit 33f6a83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions ios-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
/*
Expand Down Expand Up @@ -1448,6 +1448,7 @@ void handle_device(AMDeviceRef device) {

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) {
Expand Down Expand Up @@ -1609,10 +1610,12 @@ void timeout_callback(CFRunLoopTimerRef timer, void *info) {
{
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))
{
Expand All @@ -1630,7 +1633,7 @@ void timeout_callback(CFRunLoopTimerRef timer, void *info) {
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"
Expand Down Expand Up @@ -1723,6 +1726,7 @@ int main(int argc, char *argv[]) {
break;
case 'c':
detect_only = true;
debug = 1;
break;
case 'V':
show_version();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 33f6a83

Please sign in to comment.