Merged
Conversation
…ator crlf with unix line endings
…ewlines. Update tests to reflect stricter, reliable outputs
for more information, see https://pre-commit.ci
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances newline handling by stripping Windows-style CRLFs, preserving intended newlines in session outputs, and updating tests to expect exact trailing newlines.
- Strip
\r\nto\nin control-character removal - Remove
.strip()calls to keep command output newlines - Change fallback marker to use
echo -nand tighten test assertions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_execution.py | Updated test assertions to require exact trailing newlines |
| src/swerex/runtime/local.py | Added CRLF normalization, removed stripping of output, tweaked echo |
Comments suppressed due to low confidence (3)
src/swerex/runtime/local.py:95
- [nitpick] Consider moving the ANSI regex compilation to a module-level constant to avoid recompiling it on every call to
_strip_control_chars.
ansi_escape = re.compile(r"\x1B[@-_][0-?]*[ -/]*[@-~]")
tests/test_execution.py:65
- [nitpick] The test name
test_execute_command_with_echonis misleading; consider renaming totest_execute_command_with_echo_nfor clarity.
async def test_execute_command_with_echon(remote_runtime: RemoteRuntime):
tests/test_execution.py:55
- Add a test that simulates Windows-style CRLF output (e.g., via
printf 'line1\r\nline2\r\n') to verify the new CRLF normalization logic.
async def test_execute_command_with_empty_string_in_session(runtime_with_default_session: RemoteRuntime):
klieret
approved these changes
Jun 12, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
local.BashSession._run_normal's fallback UNIQUE_STRING based output parsingThis update makes outputs more reliable, consistent, and true to standard unix shells' expected output. For instance, outputs of
echocommands will include a training newline, which was being stripped before.