All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Cc: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>,
	Petr Baudis <pasky@suse.cz>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH 2/3] git-instaweb: Wait for server to start before running  web browser
Date: Fri, 28 May 2010 21:58:55 +0200	[thread overview]
Message-ID: <201005282158.57998.jnareb@gmail.com> (raw)
In-Reply-To: <AANLkTilpiwy2NFhOycoMBeYZFZDuVN5yFt8nIiIoYTjL@mail.gmail.com>

On Fri, 28 May 2010, Pavan Kumar Sunkara wrote:
> Jakub Narebski wrote;
> >
> > It uses IO::Socket::INET module, which is core Perl module since v5.6.0.
> 
> Core module means it will be installed by default in v5.6. But what
> happens in case of lower versions of Perl?

Gitweb itself requires even higher version of Perl for its utf-8
support: at least v5.8.0 for Encode module, and IIRC at least v5.8.3
or even v5.8.6 for correct handling of utf-8.

Perl v5.8.6 was released in 2006.

> 
> > +httpd_is_ready () {
> > +       "$PERL" -MIO::Socket::INET -e "
> > +local \$| = 1; # turn on autoflush
> > +exit if (IO::Socket::INET->new('127.0.0.1:$port'));
> > +print 'Waiting for \'$httpd\' to start ..';
> > +do {
> > +       print '.';
> > +       sleep(1);
> > +} until (IO::Socket::INET->new('127.0.0.1:$port'));
> > +print qq! (done)\n!;
> > +"
> > +}
> > +
> 
> One of the solution is to add a web server specific branch in httpd_is_ready().
> So, if the server is plackup it load the module and checks the port,
> if not it will just continue.
> 
> Just an idea for a common usage.

The above solution is universal, and works for any web server.  

We can add web server specific branch in httpd_is_ready() to use e.g. 
server_startup hook (and some blocking mechanism) for server(s) which
support it.

-- 
Jakub Narebski
Poland

  reply	other threads:[~2010-05-28 19:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28 19:11 [PATCH 0/3] git-instaweb: Support for 'plackup' and improvements Jakub Narebski
2010-05-28 19:11 ` [PATCH 1/3] git-instaweb: Remove pidfile after stopping web server Jakub Narebski
2010-05-28 19:11 ` [PATCH 2/3] git-instaweb: Wait for server to start before running web browser Jakub Narebski
2010-05-28 19:31   ` Pavan Kumar Sunkara
2010-05-28 19:58     ` Jakub Narebski [this message]
2010-05-28 19:11 ` [PATCHv4 3/3] git-instaweb: Add support for running gitweb via 'plackup' Jakub Narebski
2010-05-29  2:32   ` Eric Wong
2010-05-29  7:21     ` Eric Wong
2010-05-31 21:15 ` [PATCH 0/3] git-instaweb: Support for 'plackup' and improvements Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201005282158.57998.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    --cc=pasky@suse.cz \
    --cc=pavan.sss1991@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.