Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tui): replay all logs sent to tui with forced crlf #9962

Conversation

chris-olszewski
Copy link
Member

Description

If a task is run without a TTY (e.g. in CI) the logs will be created with LF (\n) line endings. The TUI assumes that logs are produced hooked up to a TTY where CRLF (\r\n) is used to return the cursor to the first column and move to the next row (\n behavior in non-TTY).

This PR adds a log replay method that replays logs with CRLF line endings regardless of what is in the actual file.

Future PR is to refactor this to share code with the standard log replay as I didn't have time to tackle this right at this moment.

Testing Instructions

Added quick unit test to verify this swaps out LF for CRLF and is a noop if the logs already use CRLF.

Manual Test:
First populate the logs with a non-TTY run:

[0 olszewski@macbookpro] /tmp/tui-test $ turbo @repo/ui#build > /dev/null

Using turbo@2.4.2:
Screenshot 2025-02-13 at 6 24 47 PM

Using turbo_dev from this PR
Screenshot 2025-02-13 at 6 26 04 PM

Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 13, 2025 11:26pm

Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks, Chris!

@chris-olszewski chris-olszewski merged commit 9f1a761 into main Feb 14, 2025
39 checks passed
@chris-olszewski chris-olszewski deleted the chrisolszewski/turbo-4295-properly-replay-ttynon-tty-regardless-of-tui-usage branch February 14, 2025 13:08
joshnuss pushed a commit to joshnuss/turborepo that referenced this pull request Feb 15, 2025
### Description

If a task is run without a TTY (e.g. in CI) the logs will be created
with LF (`\n`) line endings. The TUI assumes that logs are produced
hooked up to a TTY where CRLF (`\r\n`) is used to return the cursor to
the first column and move to the next row (`\n` behavior in non-TTY).

This PR adds a log replay method that replays logs with CRLF line
endings regardless of what is in the actual file.

Future PR is to refactor this to share code with the standard log replay
as I didn't have time to tackle this right at this moment.

### Testing Instructions

Added quick unit test to verify this swaps out LF for CRLF and is a noop
if the logs already use CRLF.

Manual Test:
First populate the logs with a non-TTY run:
```
[0 olszewski@macbookpro] /tmp/tui-test $ turbo @repo/ui#build > /dev/null
```

Using `turbo@2.4.2`:
<img width="797" alt="Screenshot 2025-02-13 at 6 24 47 PM"
src="https://github.com/user-attachments/assets/45439888-0098-4bb7-92b8-65eb2789cfbf"
/>

Using `turbo_dev` from this PR
<img width="762" alt="Screenshot 2025-02-13 at 6 26 04 PM"
src="https://github.com/user-attachments/assets/bd00c5dd-ebd8-41eb-9bd8-4f597925676f"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants