Why does adb return zero exit status in case of "failed to connect"?
Demo:
$ adb connect 123.123.123.123:123
failed to connect to '123.123.123.123:123': Connection refused
$ echo $?
0
Is it considered normal with adb?
Why does adb return zero exit status in case of "failed to connect"?
Demo:
$ adb connect 123.123.123.123:123
failed to connect to '123.123.123.123:123': Connection refused
$ echo $?
0
Is it considered normal with adb?
Copyright © 2021 Jogjafile Inc.
According to source code here, behind the scene the
adb connectinvokesadb_querythat returns a char array. This char array contains the result of the socket request call, something that can be displayed as string in the terminal (your 'connection refused' message for instance).adb_queryhandles error scenarios as well but the issues that can be captured are more related to file descriptor (for socket communication) or memory allocation. When such cases happen thenecho $?will return1.That said, the answer to your question is, yes, this is the intended behaviour.