Forráskód Böngészése

only destroy if we're on the same pid

if a fork happens in a script or in any module used by the script
then the object is destroyed and quit is called.

This will keep quit from being called from another forked process.
Gordon Child 14 éve
szülő
commit
1b287bd6e0
1 módosított fájl, 2 hozzáadás és 0 törlés
  1. 2 0
      lib/Selenium/Remote/Driver.pm

+ 2 - 0
lib/Selenium/Remote/Driver.pm

@@ -195,6 +195,7 @@ sub new {
         remote_conn        => undef,
         commands           => $ress,
         auto_close         => 1, # by default we will close remote session on DESTROY
+        pid                => $$,
     };
     bless $self, $class or die "Can't bless $class: $!";
 
@@ -225,6 +226,7 @@ sub new {
 
 sub DESTROY {
     my ($self) = @_;
+    return if $$ != $self->{pid};
     $self->quit() if ($self->{auto_close} && defined $self->{session_id});
 }