Skip to content

Commit

Permalink
Don't return immediately from reboot commands.
Browse files Browse the repository at this point in the history
The reboot commands return too fast, interfering with testing.
Add a pause(), which will allow the device time to complete the
reboot.

Change-Id: Ie9cc6eea67b7ff662ec71ea2329cbb94f8d55404
Bug: 11369303
  • Loading branch information
nickkral committed Oct 24, 2013
1 parent a9e453f commit 9170452
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions adb/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ void reboot_service(int fd, void *arg)
if (ret < 0) {
snprintf(buf, sizeof(buf), "reboot failed: %d\n", ret);
writex(fd, buf, strlen(buf));
goto cleanup;
}
// Don't return early. Give the reboot command time to take effect
// to avoid messing up scripts which do "adb reboot && adb wait-for-device"
while(1) { pause(); }
cleanup:
free(arg);
adb_close(fd);
Expand Down
5 changes: 5 additions & 0 deletions reboot/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ int main(int argc, char *argv[])
perror("reboot");
exit(EXIT_FAILURE);
}

// Don't return early. Give the reboot command time to take effect
// to avoid messing up scripts which do "adb shell reboot && adb wait-for-device"
while(1) { pause(); }

fprintf(stderr, "Done\n");
return 0;
}

0 comments on commit 9170452

Please sign in to comment.