FPtje / vscode-semaphore-ci

Unofficial VS Code extension for interacting with Semaphore CI
https://marketplace.visualstudio.com/items?itemName=FPtje.semaphoreci
Creative Commons Zero v1.0 Universal
5 stars 0 forks source link

Job log sometimes shows terminal control characters (`\x1b`) #2

Closed FPtje closed 2 years ago

FPtje commented 2 years ago

Sometimes I see things like this in the job log:

20220609_080034_screenshot

Those are terminal control characters. Semaphore CI gives the raw terminal output. The extension performs a naive attempt to filter those out:

https://github.com/FPtje/vscode-semaphore-ci/blob/5283c66ad89264ed3dbd8215330b5097819914b6/src/extension.ts#L455-L456

But it doesn't seem to catch all cases.

For now that regex can be updated, after taking a closer look at what terminal control characters there actually are. Alternatively it would be nice if those could actually be parsed to show the output in color. That's significantly more effort, though, so let's clear them out first.

FPtje commented 2 years ago

I'm working on re-rendering the job log as markdown. This will show commands, durations and logs like so:

Screenshot_20220625_170758

I've noticed that lines that normally are normally overwritten by other lines in the terminal, are printed in the job log besides this issue. This is because \r is used instead of \n for newlines. Let's filter that out too.

FPtje commented 2 years ago

Fixed in 0.0.4 at c08ffd1576f1441f107605f86039a8f4da6d4aad