git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] git-instaweb: Wait for server to start before running web browser

From
Jakub Narebski <jnareb@gmail.com>
Date
May 28, 2010, 19:58 UTC
Message-ID
<201005282158.57998.jnareb@gmail.com>
In-Reply-To
<AANLkTilpiwy2NFhOycoMBeYZFZDuVN5yFt8nIiIoYTjL@mail.gmail.com>
On Fri, 28 May 2010, Pavan Kumar Sunkara wrote:
Show 6 quoted lines
> 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.
Show 20 quoted lines
> 
> > +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
Previous: Pavan Kumar SunkaraNext: Jakub Narebski
Message 5 of 9 in “git-instaweb: Support for 'plackup' and improvements”
  1. 0/3 git-instaweb: Support for 'plackup' and improvementsJakub Narebski, May 28, 2010
  2. 1/3 git-instaweb: Remove pidfile after stopping web serverJakub Narebski, May 28, 2010
  3. 2/3 git-instaweb: Wait for server to start before running web browserJakub Narebski, May 28, 2010
  4. Pavan Kumar SunkaraMay 28, 2010
  5. Jakub NarebskiMay 28, 2010
  6. 3/3 git-instaweb: Add support for running gitweb via 'plackup'Jakub Narebski, May 28, 2010
  7. Eric WongMay 29, 2010
  8. Eric WongMay 29, 2010
  9. Petr BaudisMay 31, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.