[Twisted-Python] new function for t.i.main

Moshe Zadka m at moshez.org
Wed Aug 8 10:24:35 EDT 2001

On Wed, 8 Aug 2001, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:

> Sorry, no.  If you don't redirect stdout properly, your daemon is broken,
> unix or no.

I'm willing to compromise on the stdout issue.
The loop issue isn't about stack space - it's about doing stuff between
the daemonizing and the looping without writing another function.
The classical example is 

open(pidfile, 'w').write(str(os.getpid()))
> Yes.  And it should be strongly deprecated to call daemonize directly.

Why? Even if I'm writing something UNIX specific?

> I would argue that daemonize is not useful without this API.  

And that would be akin to argue that fork() is not useful without
spawn(). The fork/exec in UNIX has been shown to be very powerful.

> It's
> sufficiently small that everyone who wants to write UNIX-specific servers
> has to know about it anyway; and if they don't want to know about those
> sorts of things they ought to use the cross-platform API.

But knowing and "writing it 10 times" is different.
Especially, "and the 8th time, use stdout.close() instead of os.close(1)".

> > *I* don't care if my server infrastructure is Debian specific.
> Yes, and it's people like you that I'm trying to protect users from :-)

I'm not writing unportable code intentionally. I just don't care
about more portability which degrades quality. Like not using
fork() because it's not portable.

That sentence was written about why I want a --debianize option to 
mktap. You took it out of context.

> All it really lets you do is write servers that require a programmer to
> run on Windows.  If there's no good reason for that, it's silly.

It lets me have convenience in return for portability to a system 
nobody I really care about runs.

> For example, although the 'process' object doesn't currently run on
> Windows, its external API just relies on the notion of a process which can
> be written to and read from as a file.  Once J=FCrgen finally writes that
> cgi-for-nt implementation he was talking about many months ago, I'm sure
> it'll work fine on that platform ;-).

Sure, and that's a great abstraction -- for those who want to use it.
You would not argue that this means that twisted programs cannot use
fork(), right?

> Well, I definitely support your desire for high quality.  However, what's
> this about a "huge apt source on tm.com"?

PArtly a joke, partly a vision for a world where everybody uploads
packages into tm.com/apt, and then just

"apt-get install integrated-web-and-mail-server"

will work.
Moshe Zadka - http://moshez.geek
(if you're not cool, http://moshez.org is still working)

More information about the Twisted-Python mailing list