Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79405

Re: Struggling with python-daemon and subprocess module to work together

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Struggling with python-daemon and subprocess module to work together
Date 2014-10-22 11:04 +1100
References <CAK32T6WO=U-MUW01OEUtmxSv5bsxgQg+0P5k_ReaMaTjPQ6aBQ@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.15051.1413936295.18130.python-list@python.org> (permalink)

Show all headers | View raw


Praveen Kumar <kumarpraveen.nitdgp@gmail.com> writes:

> Previously this basic server is executed using *openvt* but I thought
> it would be nice to have a daemon process for it and used
> python-daemon.

An important difference is that a daemon process has no controlling
terminal, by definition.

> Issue I am facing is after some time server will stop sending data to
> client which suppose to happen in #120 and get error message "Cannot
> run interactive console without a controlling TTY" .

So, if the code you're running inside that daemon process needs access
to a terminal, you have at least two options:

* If the code really needs to talk on an interactive terminal, fake it
  with a pseudoterminal, and keep that pseudoterminal (its file handle)
  open.

* If, as is probably the case, the code doesn't actually need to talk on
  an interactive terminal, cut that part of the code out entirely and
  the rest will run fine inside the daemon.

-- 
 \         “I may disagree with what you say, but I will defend to the |
  `\        death your right to mis-attribute this quote to Voltaire.” |
_o__)                   —Avram Grumer, rec.arts.sf.written, 2000-05-30 |
Ben Finney

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Struggling with python-daemon and subprocess module to work together Ben Finney <ben+python@benfinney.id.au> - 2014-10-22 11:04 +1100

csiph-web