From 0cfe1ec99bb56ea2028ff942713c419c2703a7a8 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 20 Dec 2018 16:55:14 +0000 Subject: [PATCH] Work around cppdbg spamming mono errors to stdout --- python3/vimspector/debug_adapter_connection.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/python3/vimspector/debug_adapter_connection.py b/python3/vimspector/debug_adapter_connection.py index d131f7a..8f475b2 100644 --- a/python3/vimspector/debug_adapter_connection.py +++ b/python3/vimspector/debug_adapter_connection.py @@ -152,6 +152,11 @@ class DebugAdapterConnection( object ): if len( parts ) > 1: headers = parts[ 0 ] for header_line in headers.split( bytes( '\r\n', 'utf-8' ) ): + if bytes( '\n', 'utf-8' ) in header_line: + # Work around bugs in cppdbg where mono spams nonesense to stdout. + # This is such a dodgyhack, but it fixes the issues. + header_line = header_line.split( bytes( '\n', 'utf-8' ) )[ -1 ] + if header_line.strip(): key, value = str( header_line, 'utf-8' ).split( ':', 1 ) self._headers[ key ] = value @@ -172,6 +177,7 @@ class DebugAdapterConnection( object ): # Skip to reading headers. Because, what else can we do. self._logger.error( 'Missing Content-Length header in: {0}'.format( json.dumps( self._headers ) ) ) + self._buffer = bytes( '', 'utf-8' ) self._SetState( 'READ_HEADER' ) return