… | |
… | |
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 | |
… | |
… | |
414 | to save on kernel memory. |
415 | to save on kernel memory. |
415 | |
416 | |
416 | The socket is non-blocking in the parent, and blocking in the newly |
417 | The socket is non-blocking in the parent, and blocking in the newly |
417 | created process. The close-on-exec flag is set on both. Even if not used |
418 | created process. The close-on-exec flag is set on both. Even if not used |
418 | otherwise, the socket can be a good indicator for the existance of the |
419 | otherwise, the socket can be a good indicator for the existance of the |
419 | process - if the othe rprocess exits, you get a readable event on it, |
420 | process - if the other process exits, you get a readable event on it, |
420 | because exiting the process closes the socket (if it didn't create any |
421 | because exiting the process closes the socket (if it didn't create any |
421 | children using fork). |
422 | children 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 | |
|
|
437 | Win32 is a loser - code has been written for this platform, pain has been |
|
|
438 | felt, but in the end, this platform is just too broken - maybe a later |
|
|
439 | version 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 | |