diff options
author | Josh Gao <jmgao@fb.com> | 2024-01-22 14:42:37 -0800 |
---|---|---|
committer | Josh Gao <jmgao@fb.com> | 2024-01-22 17:03:20 -0800 |
commit | fa64cc2ac06c4b93bd50a4cc7911dbee39360441 (patch) | |
tree | 123c6f37bb01d88898288c56817c5a2def510904 | |
parent | 88c964baec995993f6ed7be117c612a923452fdf (diff) | |
download | adb-fa64cc2ac06c4b93bd50a4cc7911dbee39360441.tar.gz |
Fix return code of `adb shell` when device disconnects
Bug: https://issuetracker.google.com/issues/321787891
Test: (adb shell sleep 60 && echo this should not echo) & sleep 1; adb tcpip 5555
Change-Id: I25f740bd222263fcb3c501def38977db6af1e0d9
-rw-r--r-- | client/commandline.cpp | 3 |
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"; |