I'm writing an application which pipes data from mkisofs to cdrecord under Unix. Unfortunatley, I have to do this without the shell interpreting weird characters in the filenames which I'm passing to the script, so I have to use safe pipe opens. So far, I've written the following code to do this:
Okay, it sucks but it more or less works. I have two problems with this current implemenation, however:use POSIX qw(sys_wait_h); use strict; ... if ($cdrpid = open(CDREC, "|-")) { if ($isopid = open(MKISO, "-|")) { my ($rin, $nfd) = ("",""); vec($rin, fileno(CDREC), 1) = 1; if (not($nfd = select($rin, $rin, undef, 20))) { die "argh timeout"; } while (<MKISO>) { print CDREC; } close(MKISO); } else { exec "$OPT{isobin}", '-r', @ARGV; } close(CDREC); } else { exec "$OPT{cdbin}", "speed=$OPT{speed}", dev=$OPT{dev}", "tsize=@t +size", '-waiti', '-data', '-'; } waitpid($isopid, &WNOHANG); waitpid($cdrpid, &WNOHANG);
1) I would like to be able to optionally pipe the data from mkisofs to aespipe and then to cdrecord to facilitate creating encrypted CD-Rs. Right now I can't really think of a good way to do this.
2) This program is going to eventually have a frontend, so I'm going to need to read status information printed from mkisofs to STDERR to update a progress bar thingy. I'm not really sure of what the best way to do this would be either.
Any ideas would be appriciated.
In reply to Mysteries of IPC... by j0e
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |