[Zope-Coders] testDaemon.py failure

Tres Seaver tseaver@zope.com
25 Apr 2002 17:01:29 -0400


On Thu, 2002-04-25 at 15:43, Shane Hathaway wrote:
> Jeremy Hylton wrote:
> >>>>>>"CW" == Chris Withers <chrisw@nipltd.com> writes:
> >>>>>
> > 
> >   CW> Can whoever put the platform specific code in the HEAD version
> >   CW> of testDaemon.py sort it out please?
> > 
> > So you're calling me "whoever" this week?  Well, it wasn't me this
> > time.
> > 
> > It looks like the platform-dependent code has *always* been in
> > zdaemon, but there were never any tests for zdaemon.  I added a couple
> > of tests for it on Monday, and the mere fact that we now have a test
> > of zdaemon uncovers the long-standing problem.
> > 
> > I'm not sure what needs to be done -- perhaps Shane can help, since he
> > made the original checkin.  Is zdaemon even used on Windows?  Do we
> > want it to work there?
> > 
> > Toby added some calls recently that use posix.close().  We can easily
> > change those to os.close().  But posix.setsid() is not available on
> > Windows.  I don't know what it does or whether it is crucial to have
> > it.
> 
> I actually only translated it from a module to a package, so I'm not 
> 100% sure, but I think zdaemon is intended only for POSIX-compliant 
> systems.  So the zdaemon tests should probably be disabled if os.name != 
> 'posix'.

ZDaemon is in fact intended only for use on POSIX systems;  Windows has
its own service management framework, and doesn't support the semantics
which ZDaemon depends on.  Note the following from z2.py:

  if sys.platform=='win32': Zpid=''
  else: Zpid='zProcessManager.pid'

  # ...

  if Zpid and not READ_ONLY:
      import zdaemon, App.FindHomes, posix
      sys.ZMANAGED=1
    
      zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, Zpid))

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com