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

tui: don't log.Fatal on appView.Run error #246

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

gcurtis
Copy link
Contributor

@gcurtis gcurtis commented Sep 17, 2024

When the user closes their terminal (as opposed to ctrl-c), the terminal might close the tty without waiting for process-compose to exit. This causes pcv.appView.Run to return an error, which triggers a log.Fatal:

ERR Failed to start TUI error="read /dev/tty: input/output error"

This leads to a race where log.Fatal might call os.Exit before the project's processes can be stopped, leaving them orphaned.

Change log.Fatal to log.Error and explicitly shutdown the project to make sure processes aren't left behind.

When the user closes their terminal (as opposed to ctrl-c), the terminal
might close the tty without waiting for process-compose to exit. This
causes pcv.appView.Run to return an error, which triggers a log.Fatal:

  ERR Failed to start TUI error="read /dev/tty: input/output error"

This leads to a race where log.Fatal might call os.Exit before the
project's processes can be stopped, leaving them orphaned.

Change log.Fatal to log.Error and explicitly shutdown the project to
make sure processes aren't left behind.
Copy link

@gcurtis
Copy link
Contributor Author

gcurtis commented Sep 17, 2024

Hey @F1bonacc1, this is something we ran into when running devbox services up (which runs the process-compose TUI) in the VS Code terminal. Let me know if this fix makes sense. It seems to eliminate the race, but it's also a bit tricky to test.

Copy link
Owner

@F1bonacc1 F1bonacc1 left a comment

Choose a reason for hiding this comment

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

Thanks!
Good catch!

@F1bonacc1 F1bonacc1 merged commit c3f3293 into F1bonacc1:main Sep 18, 2024
3 checks passed
@gcurtis gcurtis deleted the tui-fatal branch September 18, 2024 20:05
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