in reply to not waiting for external command to complete before getting the output

I'm not familiar with cdrecord, but assuming it prints stuff to standard output while it is progressing, you could pipe its output into perl like this:

print "invoking cdrecord...\n"; open CD, "cdrecord |" or die "Couldn't run cdrecord"; while(<CD>) { # check $_ for whatever output you're looking for # or just print $_; } close CD; print "cdrecord finished\n";

I hope that's useful. If you can supply a bit more info about how cdrecord outputs its progress, that may help get a more precise answer.

  • Comment on Re: not waiting for external command to complete before getting the output
  • Download Code