<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/10865">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmo_interact/vty.py: fix parsing of vty logging<br><br>Because the VTY logging target currently prints '\n\r' instead of '\r\n', the<br>python splitlines() separates those as interleaving empty lines. Ignore '\r' to<br>allow verifying VTY logging output as well.<br><br>Change-Id: I8de9cebaa9aad275f65c3672985b7cbca343b5a6<br>---<br>M osmopy/osmo_interact/vty.py<br>1 file changed, 7 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/65/10865/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/osmopy/osmo_interact/vty.py b/osmopy/osmo_interact/vty.py</span><br><span>index 4704c09..e66ed22 100755</span><br><span>--- a/osmopy/osmo_interact/vty.py</span><br><span>+++ b/osmopy/osmo_interact/vty.py</span><br><span>@@ -110,7 +110,13 @@</span><br><span>             last_line = "%s%s" % (last_line, new_data)</span><br><span> </span><br><span>             if last_line:</span><br><span style="color: hsl(0, 100%, 40%);">-                lines = last_line.splitlines()</span><br><span style="color: hsl(120, 100%, 40%);">+                # Separate the received response into lines.</span><br><span style="color: hsl(120, 100%, 40%);">+                # But note: the VTY logging currently separates with '\n\r', not '\r\n',</span><br><span style="color: hsl(120, 100%, 40%);">+                # see _vty_output() in libosmocore logging_vty.c.</span><br><span style="color: hsl(120, 100%, 40%);">+                # So we need to jump through hoops to not separate 'abc\n\rdef' as</span><br><span style="color: hsl(120, 100%, 40%);">+                # [ 'abc', '', 'def' ]; but also not to convert '\r\n\r\n' to '\r\n\n' ('\r{\r\n}\n')</span><br><span style="color: hsl(120, 100%, 40%);">+                # Simplest is to just drop all the '\r' and only care about the '\n'.</span><br><span style="color: hsl(120, 100%, 40%);">+                lines = last_line.replace('\r', '').splitlines()</span><br><span>                 received_lines.extend(lines[:-1])</span><br><span>                 last_line = lines[-1]</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10865">change 10865</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10865"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: python/osmo-python-tests </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8de9cebaa9aad275f65c3672985b7cbca343b5a6 </div>
<div style="display:none"> Gerrit-Change-Number: 10865 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>