aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaju Mathew <shaju@google.com>2024-01-24 14:16:17 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-01-24 14:16:17 +0000
commit7806e425e18a48a0f9e580e381cdc86ed5478a4c (patch)
treef6c3a9d3705775392e2602f2e8aef34076419ea3
parent59aced8cfc23c2707dba2e3b6efc8091520e569e (diff)
parentfa64cc2ac06c4b93bd50a4cc7911dbee39360441 (diff)
downloadadb-7806e425e18a48a0f9e580e381cdc86ed5478a4c.tar.gz
Merge "Fix return code of `adb shell` when device disconnects" into main
-rw-r--r--client/commandline.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/client/commandline.cpp b/client/commandline.cpp
index 781c6d5a..c918950d 100644
--- a/client/commandline.cpp
+++ b/client/commandline.cpp
@@ -288,7 +288,8 @@ static void stdin_raw_restore() {
#endif
int read_and_dump_protocol(borrowed_fd fd, StandardStreamsCallbackInterface* callback) {
- int exit_code = 0;
+ // OpenSSH returns 255 on unexpected disconnection.
+ int exit_code = 255;
std::unique_ptr<ShellProtocol> protocol = std::make_unique<ShellProtocol>(fd);
if (!protocol) {
LOG(ERROR) << "failed to allocate memory for ShellProtocol object";