mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Check for debug server's "ready_pattern" in "stderr"
This commit is contained in:
@ -8,6 +8,11 @@ PlatformIO Core 5
|
||||
|
||||
**A professional collaborative platform for embedded development**
|
||||
|
||||
5.0.4 (2020-12-??)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Check for debug server's "ready_pattern" in "stderr"
|
||||
|
||||
5.0.4 (2020-12-30)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -134,6 +134,14 @@ class DebugServer(BaseProcess):
|
||||
self._ready = self._last_activity < (time.time() - auto_ready_delay)
|
||||
elapsed += delay
|
||||
|
||||
def _check_ready_by_pattern(self, data):
|
||||
if self._ready:
|
||||
return self._ready
|
||||
ready_pattern = self.debug_options.get("server", {}).get("ready_pattern")
|
||||
if ready_pattern:
|
||||
self._ready = ready_pattern.encode() in data
|
||||
return self._ready
|
||||
|
||||
@staticmethod
|
||||
def async_sleep(secs):
|
||||
d = defer.Deferred()
|
||||
@ -147,11 +155,11 @@ class DebugServer(BaseProcess):
|
||||
super(DebugServer, self).outReceived(
|
||||
escape_gdbmi_stream("@", data) if is_gdbmi_mode() else data
|
||||
)
|
||||
if self._ready:
|
||||
return
|
||||
ready_pattern = self.debug_options.get("server", {}).get("ready_pattern")
|
||||
if ready_pattern:
|
||||
self._ready = ready_pattern.encode() in data
|
||||
self._check_ready_by_pattern(data)
|
||||
|
||||
def errReceived(self, data):
|
||||
super(DebugServer, self).errReceived(data)
|
||||
self._check_ready_by_pattern(data)
|
||||
|
||||
def processEnded(self, reason):
|
||||
self._process_ended = True
|
||||
|
Reference in New Issue
Block a user