sub start_server {
my($self) = @_;
- my $server_pid = fork();
- if($server_pid > 0) {
- $self->{server_pid} = $server_pid;
+ $self->{server_pid} = fork();
+ if(!defined $self->{server_pid}) {
+ die "can't fork: $!";
+ }
+ if($self->{server_pid} > 0) {
my $tries = 0;
while($tries < 5) {
eval {
}
die "timed out waiting for selenium server to start" if $tries == 5;
}
- elsif($server_pid == 0) {
- close STDOUT;
- close STDERR;
+ elsif($self->{server_pid} == 0) {
# muttermutter, can't specify a host for selenium
- Alien::SeleniumRC::start("-port $self->{port}");
- }
- else {
- die "can't fork: $!";
+ exec("$^X -MAlien::SeleniumRC -e 'Alien::SeleniumRC::start(q{-port $self->{port}})'");
}
}
my($self) = @_;
# okay, we're done, kill the server.
get("http://localhost:$self->{port}/selenium-server/driver/?cmd=shutDownSeleniumServer");
+ delete $self->{src};
wait;
}
sub run_tests_for {
my ($self, $html_file) = @_;
my $rows = $self->get_rows_for($html_file);
- eval { $self->{src}->run_test_table($rows); };
+ $self->{src}->run_test_table($rows);
}
my $te = HTML::TableExtract->new;