diff --git a/adb/commandline.cpp b/adb/commandline.cpp index c9f1ee9cf..e465c3f73 100644 --- a/adb/commandline.cpp +++ b/adb/commandline.cpp @@ -685,6 +685,10 @@ static int adb_shell(int argc, const char** argv) { // Parse shell-specific command-line options. argv[0] = "adb shell"; // So getopt(3) error messages start "adb shell". +#ifdef _WIN32 + // fixes "adb shell -l" crash on Windows, b/37284906 + __argv = const_cast(argv); +#endif optind = 1; // argv[0] is always "shell", so set `optind` appropriately. int opt; while ((opt = getopt(argc, const_cast(argv), "+e:ntTx")) != -1) {