Interactive scripts (back on topic for once) [was Re: The "loop and a half"]

Peter J. Holzer hjp-usenet3 at hjp.at
Fri Oct 6 14:40:01 EDT 2017


On 2017-10-06 17:05, Grant Edwards <grant.b.edwards at gmail.com> wrote:
> On 2017-10-06, Thomas Jollans <tjol at tjol.eu> wrote:
>> Seriously? sys.stdin can be None? That's terrifying.
>
> Why?
>
> Unix daemons usually run with no stdin, stderr, or stdout.

That's pretty rare. Usually they are just connected to /dev/null or a
log file. Completely closing them is dangerous: The next open will use
the first free file descriptor and there may be parts of your daemon
(e.g. a library function) which assumes that it can write on file
descriptor 2: You don't want random error messages or warnings appear in
one of your output files (there have been a few security holes because
of this).

        hp


-- 
   _  | Peter J. Holzer    | Fluch der elektronischen Textverarbeitung:
|_|_) |                    | Man feilt solange an seinen Text um, bis
| |   | hjp at hjp.at         | die Satzbestandteile des Satzes nicht mehr
__/   | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel



More information about the Python-list mailing list