Skip to content

Fix left handside indent from exec output#628

Merged
NeffIsBack merged 3 commits intomainfrom
neff-fix-exec-output
Apr 3, 2025
Merged

Fix left handside indent from exec output#628
NeffIsBack merged 3 commits intomainfrom
neff-fix-exec-output

Conversation

@NeffIsBack
Copy link
Member

@NeffIsBack NeffIsBack commented Apr 3, 2025

Description

When retrieving output from .execute() the output is first cleaned .rstrip, which correctly removes trailing spaces/indents:

output = "\n".join([ll.rstrip() for ll in output.splitlines() if ll.strip()])

However, before logging it to the console the output is .strip() again, which now also removed leading spaces/indents. This destroys formatting from the powershell output. As we already stripped it with .rstrip we can just remove the duplicate strip (we also don't need that StringIOstuff).

Also changed the linting pipeline to trigger on code reviews, so that not linted PRs are pushed to main.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Against a Windows Server in Goad

Screenshots (if appropriate):

Before&After example of the Command Get-WindowsFeature, which uses indents to separate categories:
image
image

@NeffIsBack NeffIsBack added the bug-fix This Pull Request fixes a bug label Apr 3, 2025
@NeffIsBack
Copy link
Member Author

Also tested the modules which use = connection.execute(command, True) and therefore could be affected by the formatting changes. All looking good

@NeffIsBack
Copy link
Member Author

Also changed the linting pipeline to trigger on code reviews, so that not linted PRs are pushed to main.

With that we can enforce that only linted PRs are merged into main, so that it doesn't slip through like in #450

@NeffIsBack NeffIsBack merged commit 5a71b62 into main Apr 3, 2025
6 checks passed
@NeffIsBack NeffIsBack deleted the neff-fix-exec-output branch April 3, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix This Pull Request fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants