ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/AnyEvent-Fork/Fork.pm
(Generate patch)

Comparing cvsroot/AnyEvent-Fork/Fork.pm (file contents):
Revision 1.7 by root, Thu Apr 4 00:27:06 2013 UTC vs.
Revision 1.8 by root, Thu Apr 4 01:54:40 2013 UTC

335 Proc::FastSpawn::fd_inherit (fileno $slave); 335 Proc::FastSpawn::fd_inherit (fileno $slave);
336 336
337 # quick. also doesn't work in win32. of course. what did you expect 337 # quick. also doesn't work in win32. of course. what did you expect
338 #local $ENV{PERL5LIB} = join ":", grep !ref, @INC; 338 #local $ENV{PERL5LIB} = join ":", grep !ref, @INC;
339 my %env = %ENV; 339 my %env = %ENV;
340 $env{PERL5LIB} = join ":", grep !ref, @INC; 340 $env{PERL5LIB} = join +(AnyEvent::Fork::Util::WIN32 ? ";" : ":"), grep !ref, @INC;
341 341
342 Proc::FastSpawn::spawn ( 342 Proc::FastSpawn::spawn (
343 $perl, 343 $perl,
344 ["perl", "-MAnyEvent::Fork::Serve", "-e", "AnyEvent::Fork::Serve::me", fileno $slave, $$], 344 ["perl", "-MAnyEvent::Fork::Serve", "-e", "AnyEvent::Fork::Serve::me", fileno $slave, $$],
345 [map "$_=$env{$_}", keys %env], 345 [map "$_=$env{$_}", keys %env],
372 my ($self, @fh) = @_; 372 my ($self, @fh) = @_;
373 373
374 for my $fh (@fh) { 374 for my $fh (@fh) {
375 $self->_cmd ("h"); 375 $self->_cmd ("h");
376 push @{ $self->[2] }, \$fh; 376 push @{ $self->[2] }, \$fh;
377 push @$self, $fh; # dire hack
377 } 378 }
378 379
379 $self 380 $self
380} 381}
381 382
414to save on kernel memory. 415to save on kernel memory.
415 416
416The socket is non-blocking in the parent, and blocking in the newly 417The socket is non-blocking in the parent, and blocking in the newly
417created process. The close-on-exec flag is set on both. Even if not used 418created process. The close-on-exec flag is set on both. Even if not used
418otherwise, the socket can be a good indicator for the existance of the 419otherwise, the socket can be a good indicator for the existance of the
419process - if the othe rprocess exits, you get a readable event on it, 420process - if the other process exits, you get a readable event on it,
420because exiting the process closes the socket (if it didn't create any 421because exiting the process closes the socket (if it didn't create any
421children using fork). 422children using fork).
422 423
423=cut 424=cut
424 425
429 $self->_cmd ("r", $func); 430 $self->_cmd ("r", $func);
430} 431}
431 432
432=back 433=back
433 434
435=head1 PORTABILITY NOTES
436
437Win32 is a loser - code has been written for this platform, pain has been
438felt, but in the end, this platform is just too broken - maybe a later
439version can do it.
440
434=head1 AUTHOR 441=head1 AUTHOR
435 442
436 Marc Lehmann <schmorp@schmorp.de> 443 Marc Lehmann <schmorp@schmorp.de>
437 http://home.schmorp.de/ 444 http://home.schmorp.de/
438 445

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines