diff --git a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
--- a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -9,6 +9,7 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 import lldbvscode_testcase
+import time
 import os
 
 
@@ -37,6 +38,22 @@
 
     @skipIfWindows
     @skipIfRemote
+    def test_termination(self):
+        '''
+            Tests the correct termination of lldb-vscode upon a 'disconnect'
+            request.
+        '''
+        self.create_debug_adaptor()
+        # The underlying lldb-vscode process must be alive
+        self.assertEqual(self.vscode.process.poll(), None)
+        self.vscode.request_disconnect()
+        time.sleep(1)
+        # lldb-vscode process must have already finished even though
+        # we didn't close the communication socket explicitly
+        self.assertEqual(self.vscode.process.poll(), 0)
+
+    @skipIfWindows
+    @skipIfRemote
     def test_stopOnEntry(self):
         '''
             Tests the default launch of a simple program that stops at the
diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -2821,7 +2821,7 @@
   }
   auto request_handlers = GetRequestHandlers();
   uint32_t packet_idx = 0;
-  while (true) {
+  while (!g_vsc.sent_terminated_event) {
     std::string json = g_vsc.ReadJSON();
     if (json.empty())
       break;