question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiline strings infinite loop

See original GitHub issue

There’s a weird thing that happens when you use multiline strings with the rainbow animation:

sample:

chalkAnimation.rainbow(`tripping on rainbow road`); // is OK
chalkAnimation.rainbow(`
tripping on rainbow road`); // infinite loop of newlines

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bokubcommented, Nov 15, 2017

All right, with a logo this big I can understand why the performance is bad.

Anyway, if you still want some fancy 🌈 without the animation, I suggest you gradient-string, another project of mine

1reaction
bokubcommented, Nov 14, 2017

chalk-animation cannot do it, but you do!

const logo = [ 
	"  __",
	"<(o )___",
	" ( ._> /",
	"  `---'",
].join('\n');

const cls = `\u001b[2J\u001b[0;0H`;

const rainbow = chalkAnimation.rainbow(logo).stop(); // Don't start the animation

setInterval(function () {
	console.log(cls); // Clear screen
	rainbow.render(); // Render a frame
}, 15);

The \u001b[2J escape code will clear the screen, and \u001b[0;0H will put the cursor at 0,0 (optional, will render differently if you remove it).

Read more comments on GitHub >

github_iconTop Results From Across the Web

reading multiple lines of input always runs an infinite loop ...
I'm trying to process multiple lines of input from the console using a Scanner in Java, and it runs in an infinite loop...
Read more >
Appendix to Detecting and Escaping Infinite Loops with Jolt
Abstract. Infinite loops make applications unresponsive. Potential prob- lems include lost work or output, denied access to application functional-.
Read more >
for loop with multiline data - bash - Unix Stack Exchange
I need to create a script with a loop through a list of items. I want to insert a string in the script....
Read more >
ControlStructureSpacingSniff fails on multiline string #2642
Fails (with infinite loop?) when handling a multiline string. /ccel-shared# cli/vendor/bin/phpcs --version PHP_CodeSniffer version 3.5.0 (stable) ...
Read more >
Top 4 Types of Statements in Python Infinite Loop - eduCBA
Here we discuss Introduction to Python Infinite Loop and Different types of ... loop can be a single line or even a block...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found