animetosho / ParPar

High performance PAR2 create client for NodeJS
202 stars 21 forks source link

Is --progress stdout working? #22

Closed mbruel closed 4 years ago

mbruel commented 4 years ago

Hi, It seems to not work on my env... Am I doing something wrong?

~/Downloads/testNgPost$ ~/apps/ParPar/bin/parpar.js --version
0.3.1
~/Downloads/testNgPost$ ~/apps/ParPar/bin/parpar.js -s1M -r8% -m1024M --progress stdout -o test.par2 jdk-8u171-linux-x64.tar.gz > out.txt 2> err.txt
~/Downloads/testNgPost$ wc -l out.txt err.txt 
  0 out.txt
  4 err.txt
  4 total

In fact --progress none is also doing the same :\

animetosho commented 4 years ago

What's the contents of err.txt?

mbruel commented 4 years ago
~/Downloads/testNgPost$ cat err.txt 
Multiply method used: Shuffle (256 bit), 8 threads
Generating 15 MiB recovery data (15 slices) from 182.05 MiB of data

PAR2 created. Time taken: 0.743 second(s)

There is no progress information, probably cause the file is too small and thus the generation too fast. Anyway I would expect to have all this text on stdout also. This is not errors. Could you do it?

animetosho commented 4 years ago

There should always be progress output, as the 100% text is always written. wc -l counts newlines as opposed to lines, and the progress output never writes a newline, so perhaps you're thinking that there's no output on stdout. Try actually checking the size of out.txt itself, and if you open it, you may find the progress information there.

mbruel commented 4 years ago

my out.txt is empty, not sure why... But it seems to work well if I use it with ngPost. Except I've still those 3 lines in stderr that are flagged as errors and thus displayed in red in ngPost GUI Could write all that in stdout too plz?

animetosho commented 4 years ago

my out.txt is empty, not sure why...

How are you checking that? Does du -b out.txt say the size is 0 bytes?

Except I've still those 3 lines in stderr that are flagged as errors

Use the -q flag.

mbruel commented 4 years ago
~/Downloads/testNgPost$ du -b out.txt 
2184    out.txt

but if I edit the file I don't see anything.... Is it cause you're using \r to rewrite on the same line ?

Use the -q flag.

Cool that's perfect! (using --progress stdout -q) I thought the -q would force --progress none and thus I wouldn't get any progress indication. That's what I understood from your description

       --progress            Progress indicator display, which can be either:
                                 none: disable progress output
                                 stderr: output a progress indicator to stderr
                                 stdout: output a progress indicator to stdout
                             Default is `stderr`, or `none` if `--quiet` is
                             specified.
  -q,  --quiet               Suppress information output. Errors will still be
                             displayed
animetosho commented 4 years ago

but if I edit the file I don't see anything.... Is it cause you're using \r to rewrite on the same line ?

It uses magic terminal sequences to clear the line. Terminal editors may have a bit of an issue dealing with them, though most good text editors shouldn't have any problems.

I thought the -q would force --progress none and thus I wouldn't get any progress indication. That's what I understood from your description

If you have a wording suggestion, I can consider it.

mbruel commented 4 years ago

Terminal editors may have a bit of an issue dealing with them, though most good text editors shouldn't have any problems.

true, vim is seeing the content Calculating: 2.61%Calculating: 4.52%Calculating: 5.47%Calculating: 6.54%Calculating: 8.20%Calculating: 9.39%Calculating: 10.35%Calculating: 11.48%Calculating: 12.31%Calculating: 13.56%Calculating: 14.69%Calculating: 15.94%Calculating: 17.13%Calculating: 18.20%Calculating: 19.15%Calculating: 20.46%Calculating: 21.65%Calculating: 22.90%Calculating: 23.91%Calculating: 25.10%Calculating: 26.29%Calculating: 27.30%Calculating: 28.55%Calculating: 29.74%Calculating: 30.51%Calculating: 31.64%Calculating: 32.83%Calculating: 34.14%Calculating: 35.21%Calculating: 36.34%Calculating: 37.59%Calculating: 38.78%Calculating: 39.97%Calculating: 41.16%Calculating: 41.93%Calculating: 43.06%Calculating: 44.25%Calculating: 45.44%Calculating: 46.40%Calculating: 47.59%Calculating: 48.72%Calculating: 49.97%Calculating: 51.27%Calculating: 52.46%Calculating: 53.36%Calculating: 54.37%Calculating: 55.56%Calculating: 56.63%Calculating: 57.58%Calculating: 58.71%Calculating: 59.96%Calculating: 60.97%Calculating: 61.86%Calculating: 63.17%Calculating: 64.24%Calculating: 65.19%Calculating: 66.38%Calculating: 67.69%Calculating: 68.59%Calculating: 69.83%Calculating: 71.02%Calculating: 72.27%Calculating: 73.05%Calculating: 74.24%Calculating: 75.37%Calculating: 76.38%Calculating: 77.45%Calculating: 78.52%Calculating: 79.47%Calculating: 80.84%Calculating: 82.03%Calculating: 83.16%Calculating: 84.17%Calculating: 85.42%Calculating: 86.73%Calculating: 87.62%Calculating: 88.69%Calculating: 89.64%Calculating: 91.01%Calculating: 92.20%Calculating: 93.45%Calculating: 94.70%Calculating: 95.24%Calculating: 96.13%Calculating: 97.44%Calculating: 98.45%Calculating: 99.70%Calculating: 99.99%Calculating: 99.99%Calculating: 99.99%Calculating: 100.00% I would have expect wc to see one line and the terminal to print the last "Calculating: 100.00%"...

If you have a wording suggestion, I can consider it.

hum maybe adding something on the --quiet option.

-q,  --quiet               Suppress information output. Errors will still be
                             displayed. (Progress will still output if --progress is specified other than none)
animetosho commented 4 years ago

Okay thanks, I've tweaked the text a little.