Ok, here you go, this works, tested on linux. It uses sysread
to get the output, and it gets around the \r problem.
#!/usr/bin/perl
use warnings;
use IPC::Open3;
#cdrecord sends a /r (no newline) to output status
#so it is difficult to get output
my $pid = open3(\*WRITE, \*READ,0,"/usr/bin/cdrecord -v -dummy -eject
+dev=1,1,0 my.iso");
#if \*ERROR is false, STDERR is sent to STDOUT
while(1){
select(undef,undef,undef,.01);
if( sysread \*READ,$output,1024 ){
print "$output\n";
}else{ print "finished\n"; exit; }
}
OUTPUT from my testing:
Track 01: 89 of 97 MB written (fifo 100%) [buf 99%] 27.3x.
Track 01: 90 of 97 MB written (fifo 100%) [buf 99%] 26.5x.
Track 01: 91 of 97 MB written (fifo 98%) [buf 99%] 27.3x.
Track 01: 92 of 97 MB written (fifo 100%) [buf 99%] 26.6x.
Track 01: 93 of 97 MB written (fifo 98%) [buf 99%] 27.4x.
Track 01: 94 of 97 MB written (fifo 100%) [buf 99%] 26.6x.
Track 01: 95 of 97 MB written (fifo 100%) [buf 99%] 27.4x.
Track 01: 96 of 97 MB written (fifo 100%) [buf 99%] 28.3x.
Track 01: 97 of 97 MB written (fifo 100%) [buf 99%] 27.5x.
Track 01: Total bytes read/written: 102400000/102400000 (50000 sectors
+).
Writing time: 42.959s
Average write speed 15.5x.
Min drive buffer fill was 99%
Fixating...
WARNING: Some drives don't like fixation in dummy mode.
Fixating time: 26.760s
/usr/bin/cdrecord: fifo had 1613 puts and 1613 gets.
/usr/bin/cdrecord: fifo was 0 times empty and 872 times full, min fill
+ was 85%.
finished
I'm not really a human, but I play one on earth.
flash japh
|