Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Fix issue where calls to utils.printData hangs #283

Merged
merged 2 commits into from
Mar 27, 2018

Conversation

codebycaleb
Copy link
Contributor

Resolves #279

When calls to utils.printData were made on a headless machine (such as a CI) or a "skinny" terminal (with a column width less than a certain amount of columns - 15 would always do it), the call would get stuck in a while loop. To make a long story short, this loop was lopping off text based on how many columns we had calculated were available for use. But when the calculated width was non-positive, the text-lopping never ended because we were saying ~'drop the first -6 characters of "example"'.

Now, when the calculated width is non-positive, the entire while-loop is avoided by directly returning the makePlain call.

As a bonus, this should fix an old test that was marked skipped. :)

When running utils.printData on a headless terminal (such as a CI)
or a "skinny" terminal window, the call would hang indefinitely.
The call was getting into a never-ending while-loop because the
calculated window space was too small for output. Instead of going
into that while-loop, if the calculated window space is too small,
the printData call will switch from row output to plain output.
@codebycaleb codebycaleb requested a review from xavdid March 27, 2018 11:05
Copy link
Contributor

@xavdid xavdid left a comment

Choose a reason for hiding this comment

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

Awesome, works great!

As a point of order, make sure to claim the corresponding jira ticket before you work on stuff. We want to make sure we're not repeating work! You know there's a ticket because ZapZaplar commented on the external issue.

@codebycaleb
Copy link
Contributor Author

D'oh! I saw the comment but I didn't realize it meant Jira. Got it for the future. Thanks!

@xavdid
Copy link
Contributor

xavdid commented Mar 27, 2018

No problem at all! Anyway, looks great. go ahead and merge it when you're ready.

@codebycaleb codebycaleb merged commit 43f2356 into master Mar 27, 2018
@codebycaleb codebycaleb deleted the fix-printData-hang branch March 27, 2018 19:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calls to utils.printData hangs for 'row' format with small displays
2 participants