Last active
February 13, 2020 10:52
-
-
Save sleekweasel/3d7da7c0841d1d0871e50a6022e1255f to your computer and use it in GitHub Desktop.
Patch for adb - prevent automatic server launch, if adb server is not running.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/adb/adb.cpp b/adb/adb.cpp | |
index 6b30be884..e05b707ed 100644 | |
--- a/adb/adb.cpp | |
+++ b/adb/adb.cpp | |
@@ -664,7 +664,13 @@ static void ReportServerStartupFailure(pid_t pid) { | |
while (static_cast<size_t>(i) < lines.size()) fprintf(stderr, "%s\n", lines[i++].c_str()); | |
} | |
+const char* env_adb_server_autostart = "ADB_SERVER_AUTOSTART"; | |
int launch_server(const std::string& socket_spec) { | |
+ const char* autostart_server = getenv(env_adb_server_autostart); | |
+ if (autostart_server && strcmp(autostart_server, "false") == 0) { | |
+ fprintf(stderr, "adb: Not launching server: %s = %s\n", env_adb_server_autostart, autostart_server); | |
+ return -1; | |
+ } | |
#if defined(_WIN32) | |
/* we need to start the server in the background */ | |
/* we create a PIPE that will be used to wait for the server's "OK" */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment