Changeset 17284
- Timestamp:
- 2008-09-15T12:26:54+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/downloaders/Z3950Download.pm
r17232 r17284 36 36 use BaseDownload; 37 37 use IPC::Open2; 38 use POSIX ":sys_wait_h"; # for waitpid, http://perldoc.perl.org/functions/waitpid.html 38 39 39 40 sub BEGIN { … … 149 150 my $childpid = open2(*YAZOUT, *YAZIN, $yaz) 150 151 or (print STDERR "<<Finished>>\n" and die "can't open pipe to yaz-client: $!"); 152 $self->{'pid'} = $childpid; 151 153 $self->{'YAZOUT'} = *YAZOUT; 152 154 $self->{'YAZIN'} = *YAZIN; … … 187 189 188 190 close($self->{'YAZOUT'}); 191 192 # Is the following necessary? The PerlDoc on open2 (http://perldoc.perl.org/IPC/Open2.html) 193 # says that waitpid must be called to "reap the child process", or otherwise it will hang 194 # around like a zombie process in the background. Adding it here makes the code work as 195 # before, but it is certainly necessary to call waitpid on wget (see WgetDownload.pm). 196 # http://perldoc.perl.org/functions/waitpid.html 197 my $kidpid; 198 do { 199 $kidpid = waitpid($self->{'pid'}, WNOHANG); 200 } while $kidpid > 0; # waiting for pid to become -1 189 201 } 190 202
Note:
See TracChangeset
for help on using the changeset viewer.