# If the write handle is a dup give it away entirely, close my copy
# of it.
xclose $dad_wtr if $dup_wtr;
it seems like my script is actually dying at the open3 step
Oops, yeah, I knew that. So it's an unrelated problem.
Let's find out more details:
$ perl -MCarp=verbose a.pl
open3: close(4) failed: Bad file descriptor at /usr/share/perl/5.8/IPC
+/Open3.pm line 70
IPC::Open3::xclose(4) called at /usr/share/perl/5.8/IPC/Open3.
+pm line 218
IPC::Open3::_open3('open3', 'main', '<&4', '>&STDOUT', '>&STDE
+RR', '/bin/cat') called at /usr/share/perl/5.8/IPC/Open3.pm line 229
IPC::Open3::open3('<&4', '>&STDOUT', '>&STDERR', '/bin/cat') c
+alled at a.pl line 21
Doh! It's calling close("4")!
xclose $dad_wtr if $dup_wtr;
should be
if ($dup_wtr) {
if (fh_is_fd($dad_wtr)) {
xclose $dad_wtr;
} else {
xfdclose xfileno($dad_wtr);
}
}
Defining xfdclose is left as a task to the reader.
|