A progress indicator is required for the Perl system () command using T: R: G mod

I need a progress indicator that outputs Perl output

system('make') 

and for each line output to STDOUT from the make command, I want to display a point as an indicator of progress. Unfortunately, I use the Term :: ReadLine :: Gnu Perl method.

How to redirect STDOUT to capture and count lines when running make command?

+4
source share
2 answers
 #!/usr/bin/perl my $command = "make"; open (my $cmd, "$command |"); while(<$cmd>){ print "."; } print "\n"; 
+7
source
 make >& >(while read f; do echo -n .; done; echo) 

Obviously, this is a shell solution, but a point as an indicator of progress is a point.

You could, of course, insert a tee there to save a copy of the make file in case of problems.

Since you did not like (not approved or accepted) the shell decision for some inexplicable reason, here is a pure perl one:

 if (open(X,"make|")) { local($|)=1; while(<X>) { print "."; } close(X); print "\n";} 
+4
source

All Articles