Skip to content

Commit

Permalink
Merge pull request alibaba#300 from lilbedwin/reload
Browse files Browse the repository at this point in the history
add sub reload() to Nginx.pm of nginx-tests
  • Loading branch information
yaoweibin committed Aug 14, 2013
2 parents 4960575 + 5c0e784 commit d1db84c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/nginx-tests/nginx-tests/lib/Test/Nginx.pm
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,29 @@ sub stop() {
return $self;
}

sub reload() {
my ($self) = @_;

return $self unless $self->{_started};

if ($^O eq 'MSWin32') {
my $testdir = $self->{_testdir};
my @globals = $self->{_test_globals} ?
() : ('-g', "pid $testdir/nginx.pid; "
. "error_log $testdir/error.log debug;");
system($NGINX, '-c', "$testdir/nginx.conf", '-s', 'reload',
@globals) == 0
or die "system() failed: $?\n";

} else {
kill 'HUP', `cat $self->{_testdir}/nginx.pid`;
}

sleep(1);

return $self;
}

sub stop_daemons() {
my ($self) = @_;

Expand Down

0 comments on commit d1db84c

Please sign in to comment.