x64 hg.exe

Adrian Buehlmann adrian at cadifra.com
Fri Jun 22 09:38:24 CDT 2012


On 2012-06-22 13:07, Adrian Buehlmann wrote:
> On 2012-06-22 03:42, Adrian Buehlmann wrote:
>> I've built an exemaker exe
>>
>>   hg-x64-385eaa517487.exe
> 
> No luck. The serve tests fail with the exe when -d is specified:
> 
>   $ hg --traceback serve -n test -p 20059 -d --pid-file=hg.pid -E errors.log
>   Traceback (most recent call last):
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 88, in _runcatch
>       return _dispatch(req)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 739, in _dispatch
>       cmdpats, cmdoptions)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 513, in runcommand
>       ret = _runcommand(ui, options, cmd, d)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 829, in _runcommand
>       return checkargs()
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 800, in checkargs
>       return cmdfunc()
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 736, in <lambda>
>       d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\util.py", line 475, in check
>       return func(*args, **kwargs)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\extensions.py", line 139, in wrap
>       util.checksignature(origfn), *args, **kwargs)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\util.py", line 475, in check
>       return func(*args, **kwargs)
>     File "C:\Users\adi\hgrepos\hg-main\hgext\mq.py", line 3505, in mqcommand
>       return orig(ui, repo, *args, **kwargs)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\util.py", line 475, in check
>       return func(*args, **kwargs)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\commands.py", line 5120, in serve
>       cmdutil.service(opts, initfn=service.init, runfn=service.run)
>     File "C:\Users\adi\hgrepos\hg-main\mercurial\cmdutil.py", line 486, in service
>       raise util.Abort(_('child process failed to start'))
>   Abort: child process failed to start
>   abort: child process failed to start
> 
> And it's not because of a problem with the port. An identical
> 
>   $ python hg.py --traceback serve -n test -p 20070 -d --pid-file=hg.pid -E errors.log
> 
>   adi at kork /hgrepos/hg-main
> 
> works.
> 
> Without -d, the exe works:
> 
>   $ hg --traceback serve -n test -p 20059
> 
> So there's a problem with --daemon in combination with the exe.

With

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1395,6 +1395,7 @@
     if SIGCHLD is not None:
         prevhandler = signal.signal(SIGCHLD, handler)
     try:
+        print "calling spawndetached():", args
         pid = spawndetached(args)
         while not condfn():
             if ((pid in terminated or not testpid(pid))

and hg.exe, I see (in sh of MSYS):

$ hg --traceback serve -n test -p 20070 -d --pid-file=hg.pid -E errors.log
calling spawndetached(): ['C:\\Users\\adi\\hgrepos\\hg-main\\hg.exe', 'C:\\Users\\adi\\hgrepos\\hg-main\\hg.py', '--traceback', 'serve', '-n', 'test', '-p', '20070', '-d', '--pid-file=hg.pid', '-E', 'errors.log', '--daemon-pipefds=c:\\tmp\\hg-service-za7au5']

If I use the hg file (with Python in PATH), I see:

$ hg --traceback serve -n test -p 20070 -d --pid-file=hg.pid -E errors.log
calling spawndetached(): ['c:\\Python\\python.exe', './hg', '--traceback', 'serve', '-n', 'test', '-p', '20070', '-d', '--pid-file=hg.pid', '-E', 'errors.log', '--daemon-pipefds=c:\\tmp\\hg-service-r3tnre']

Similar to:

$ python hg.py --traceback serve -n test -p 20070 -d --pid-file=hg.pid -E errors.log
calling spawndetached(): ['c:\\Python\\python.exe', 'hg.py', '--traceback', 'serve', '-n', 'test', '-p', '20070', '-d', '--pid-file=hg.pid', '-E', 'errors.log', '--daemon-pipefds=c:\\tmp\\hg-service-x8rclt']


So, for the hg.exe case, we have something unusual: The first arg is not the python interpreter, but the hg.exe. The second arg is the hg.py python script. But running 'hg.exe hg.py' obviously doesn't work:

  $ hg.exe hg.py version
  hg: unknown command 'hg.py'





More information about the Mercurial-devel mailing list