animetosho / ParPar

High performance PAR2 create client for NodeJS
193 stars 19 forks source link

Verbose commandline switch? #5

Closed boranblok closed 7 years ago

boranblok commented 7 years ago

Is it possible to include a verbose commandline switch so we get more feedback at runtime it is actually doing stuff?

I am mainly asking because I run your application from mine. But right now my code checks if the external application is alive by looking at the returned messages. If no messages are returned in X minutes (configurable, default: 5) I consider the external process hung and kill it. A verbose mode would let me know things are still being worked on.

animetosho commented 7 years ago

ParPar should be outputting to stderr every 200ms (may change to 1s) with the progress, so you should always be getting output. I presume you're monitoring both standard output and standard error?

Otherwise I'm not too sure what one could put in verbose mode as it's mostly just processing blocks of input...

boranblok commented 7 years ago

I see why my program is failing on it.

I am looking for complete lines from the standard output and error. It seems however that progress is being given by backspacing over previous output and updating that way, so no newline is entered until the command has finished.

This seems more like an issue on my end of how I detect process activity rather than something that has to be changed on your end. So this issue is closed.

animetosho commented 7 years ago

Ah I see (I thought most programs worked in a similar way?).

boranblok commented 7 years ago

Maybe, but cmdline par2 and rar output more newlines.

In any case, my code has been modified and works fine now.

I am also wondering why you output to stderr and not stdout. The former is logged as warnings by my application. But this is maybe a separate issue alltogether.

animetosho commented 7 years ago

par2cmdline looks like it uses linefeeds to go back to the start of the line, whilst ParPar uses the line clear escape sequence. I find the latter a little more reliable in that it clears the line before writing, so if the text is shorter than what was previously there, you don't get gunk left over. I don't think it's possible for a line to ever be shorter in ParPar, but I just typically do it in my applications.

stderr, I'd say, is the proper place to write diagnostic/information messages to. stdout is for output (which ParPar currently has none, but may have in the future), and is buffered by default, whilst stderr is for stuff to be displayed on screen, and isn't buffered.