<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/python/osmo-python-tests/+/15274">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">vty.py: Fix endl removed when pkt buffer content ends exactly on a newline char<br><br>As a result, osmo_interact_vty.py was printing incorrect output:<br>"""<br>-        <param name='shutdown' doc='Remove the APN from administrative shut-down' /><br>-      </params><br>+        <param name='shutdown' doc='Remove the APN from administrative shut-down' />      </params<br>"""<br><br>Change-Id: Ib1dbf39db1b27331ea4c39051e550a87780d9f76<br>---<br>M osmopy/osmo_interact/vty.py<br>1 file changed, 10 insertions(+), 3 deletions(-)<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/74/15274/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 e66ed22..f4b9aff 100755</span><br><span>--- a/osmopy/osmo_interact/vty.py</span><br><span>+++ b/osmopy/osmo_interact/vty.py</span><br><span>@@ -116,9 +116,16 @@</span><br><span>                 # So we need to jump through hoops to not separate 'abc\n\rdef' as</span><br><span>                 # [ 'abc', '', 'def' ]; but also not to convert '\r\n\r\n' to '\r\n\n' ('\r{\r\n}\n')</span><br><span>                 # Simplest is to just drop all the '\r' and only care about the '\n'.</span><br><span style="color: hsl(0, 100%, 40%);">-                lines = last_line.replace('\r', '').splitlines()</span><br><span style="color: hsl(0, 100%, 40%);">-                received_lines.extend(lines[:-1])</span><br><span style="color: hsl(0, 100%, 40%);">-                last_line = lines[-1]</span><br><span style="color: hsl(120, 100%, 40%);">+                last_line = last_line.replace('\r', '')</span><br><span style="color: hsl(120, 100%, 40%);">+                lines = last_line.splitlines()</span><br><span style="color: hsl(120, 100%, 40%);">+                if last_line.endswith('\n'):</span><br><span style="color: hsl(120, 100%, 40%);">+                    received_lines.extend(lines)</span><br><span style="color: hsl(120, 100%, 40%);">+                    last_line = ""</span><br><span style="color: hsl(120, 100%, 40%);">+                else:</span><br><span style="color: hsl(120, 100%, 40%);">+                    # if pkt buffer ends in the middle of a line, we need to keep</span><br><span style="color: hsl(120, 100%, 40%);">+                    # last non-finished line:</span><br><span style="color: hsl(120, 100%, 40%);">+                    received_lines.extend(lines[:-1])</span><br><span style="color: hsl(120, 100%, 40%);">+                    last_line = lines[-1]</span><br><span> </span><br><span>             match = self.re_prompt.match(last_line)</span><br><span>             if not match:</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/python/osmo-python-tests/+/15274">change 15274</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/c/python/osmo-python-tests/+/15274"/><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-Change-Id: Ib1dbf39db1b27331ea4c39051e550a87780d9f76 </div>
<div style="display:none"> Gerrit-Change-Number: 15274 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>