[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.7-963-g6da0cee

? sunnavy sunnavy at bestpractical.com
Tue Dec 21 01:12:53 EST 2010


The branch, 3.9-trunk has been updated
       via  6da0ceebc1d3a0c669fbcb91466383fb4f369fc3 (commit)
      from  94bed282b184c41104a7cce7803dc9bb7771e298 (commit)

Summary of changes:
 sbin/rt-server.in |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit 6da0ceebc1d3a0c669fbcb91466383fb4f369fc3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Dec 21 14:11:20 2010 +0800

    tweak bind error msg: we need to know the right port number

diff --git a/sbin/rt-server.in b/sbin/rt-server.in
index ff7c993..8b19c22 100755
--- a/sbin/rt-server.in
+++ b/sbin/rt-server.in
@@ -174,7 +174,17 @@ my $r = Plack::Runner->new( $0 =~ 'standalone' ? ( server => 'Standalone' ) :
                                                : (),
                             env => 'deployment' );
 my @args = @ARGV;
-push @args, '--port', $port unless grep { m/--port/ } @args;
+
+use List::MoreUtils 'last_index';
+my $last_index = last_index { $_ eq '--port' } @args; 
+
+if ( $last_index != -1 && $args[$last_index+1] =~ /^\d+$/ ) {
+    $port = $args[$last_index+1];
+}
+else {
+    push @args, '--port', $port;
+}
+
 push @args, '--server', 'Standalone' if RT->InstallMode;
 push @args, '--server', 'Starlet' unless $r->{server} || grep { m/--server/ } @args;
 
@@ -214,8 +224,8 @@ sub handle_bind_error {
 
     print STDERR <<EOF;
 WARNING: RT couldn't start up a web server on port @{[$port]}.
-This is often the case if you're running @{[$0]} as 
-someone other than your system's "root" user.  You may also specify a
+This is often the case if the port is already in use or you're running @{[$0]} 
+as someone other than your system's "root" user.  You may also specify a
 temporary port with: $0 --port <port>
 EOF
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list