THRIFT-4515: cross server test improvement: graceful test server shutdown
This closes #1509
diff --git a/test/perl/TestServer.pl b/test/perl/TestServer.pl
index 7d8f929..e8c1cfa 100644
--- a/test/perl/TestServer.pl
+++ b/test/perl/TestServer.pl
@@ -26,6 +26,8 @@
use Getopt::Long qw(GetOptions);
use Time::HiRes qw(gettimeofday);
+$SIG{INT} = \&sigint_handler;
+
use lib '../../lib/perl/lib';
use lib 'gen-perl';
@@ -146,6 +148,12 @@
my $server = new Thrift::SimpleServer($processor, $serversocket, $transport, $protocol);
print "Starting \"simple\" server ($opts{transport}/$opts{protocol}) listen on: $listening_on\n";
$server->serve();
+print "done.\n";
+
+sub sigint_handler {
+ print "received SIGINT, stopping...\n";
+ $server->stop();
+}
###
### Test server implementation