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

Fallback to non-colored inspect when coloring takes too long #759

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

osyoyu
Copy link

@osyoyu osyoyu commented Nov 13, 2023

Inspecting large objects may take a long time since IRB colors the entire output of #inspect all at once.
This patch lets IRB to give up coloring after a certain time and fall back to non-colored output.
Changes can be observed by inspecting large Arrays, for example [1] * 1000000.

The default timeout is 2 seconds, but this can be configured through IRB.conf[:INSPECT_COLORING_TIMEOUT].
Passing nil to this option will disable timeouts (IRB will never fall back to non-colored output).

Inspecting large objects may take a long time since IRB colors
the entire output of #inspect all at once.
This patch lets IRB to give up coloring after a certain time and fall
back to non-colored output.
Changes can be observed by inspecting large Arrays, for example
`[1] * 1000000`.

The default timeout is 2 seconds, but this can be configured through
`IRB.conf[:INSPECT_COLORING_TIMEOUT]`.
Passing nil to this option will disable timeouts (IRB will never fall
back to non-colored output).
@st0012
Copy link
Member

st0012 commented Nov 18, 2023

Thanks for the PR 👍
However, it will not be the best solution to the problem because using timeout will cause hanging problems with debug for the irb:rdbg integration. See ruby/debug#877

Maybe we should improve colour printer instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants