nodejs-dashboard icon indicating copy to clipboard operation
nodejs-dashboard copied to clipboard

process.stdout.write no output

Open loretoparisi opened this issue 10 years ago • 4 comments

I have no output in the stdout view, when doing

const spinner = [ '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' ];
process.stdout.write(" "+spinner[ (index+1)% spinner.length ]+"\r" );

loretoparisi avatar Oct 18 '16 16:10 loretoparisi

When trying a similar example it's printing each character on a separate line. This is because the dashboard is treating each stream event as a new log entry. Are the characters not visible to you? Does it work without the dashboard?

jasonwilson avatar Oct 20 '16 03:10 jasonwilson

@jasonwilson running node from shell, it will print out the char and feed back to line start) like in

const spinner = [ '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' ];
for(var count=0;count<100000;count++) process.stdout.write(" "+spinner[  (count+1)% spinner.length ]+"\033[0G" ); // \033[0G | \r | \x1B[0G

while in In node-dashboard it does not output to stdin

loretoparisi avatar Oct 20 '16 07:10 loretoparisi

Unable to reproduce. WIth the first example

const spinner = [ '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' ];
process.stdout.write(" "+spinner[ (index+1)% spinner.length ]+"\r" );

I see nothing in stdout because it throws an error (index is not defined)

Second example

const spinner = [ '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' ];
for(var count=0;count<100000;count++) process.stdout.write(" "+spinner[  (count+1)% spinner.length ]+"\033[0G" );

I see something like this

screen shot 2017-02-14 at 10 12 46 am

my terminal doesn't recognize \033[0G but there's definitely text going to stdout

aisapatino avatar Feb 14 '17 18:02 aisapatino

Closing this issue as it seems to be caused by code error. If this is not the case please comment.

jjasonclark avatar Nov 29 '17 02:11 jjasonclark