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


Groups > comp.lang.python > #2714

Re: Behaviour of subprocess.Popen, ssh and nohup I don't understand

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'received:209.85.212.46': 0.03; 'received:mail-vw0-f46.google.com': 0.03; 'ubuntu': 0.04; 'wed,': 0.04; 'subject:don': 0.09; 'tty': 0.09; 'am,': 0.14; 'wrote:': 0.14; '"with': 0.16; "'rb')": 0.16; 'inherited': 0.16; 'solves': 0.16; 'stdin': 0.16; 'subject:ssh': 0.16; 'subject:skip:s 10': 0.16; 'input': 0.18; 'handles': 0.20; 'cc:no real name:2**0': 0.20; '(which': 0.21; 'help.': 0.22; 'header:In- Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'received:209.85.212': 0.25; 'instead': 0.26; 'url:mailman': 0.27; 'message-id:@mail.gmail.com': 0.28; 'problem': 0.29; 'operating': 0.30; 'cc:addr:python.org': 0.31; 'cc:addr:gmail.com': 0.31; 'none,': 0.31; 'url:library': 0.31; 'thank': 0.32; 'url:listinfo': 0.33; 'url:docs': 0.33; 'using': 0.34; 'there': 0.35; 'file': 0.35; 'background': 0.37; 'connected': 0.37; 'received:209.85': 0.37; 'url:python': 0.37; 'run': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'url:org': 0.38; 'cc:2**1': 0.38; 'likely': 0.39; 'received:209': 0.39; 'header:Received:5': 0.40; 'charset:windows-1252': 0.61; '2011': 0.62; 'reads': 0.65; '12:47': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6oFG4kZnrKtO07CPQDlryO9WqLIhoLIEsoGIqnOPjsU=; b=rk4eqHXA+ZEJfxEwSs1VfaYGNHq9WvHDOak3+X+hJC/71VePt3m3qxZcQVC5T1EPwu w0hC/2pVVhSf1Xmepneg741vC2LAScEp9xNVpFskg5FxqxZ/kY4Txn8bvPmeOpzY3NXO BkbE1JMvYU0RbtGjMSeJHm6QNn2VcXzMVzHGM=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=NinMI0ylbSUHuaDHFVTg9IXQlk9YlD6/FEvNP1Mr3ZQqmCczUGjqYfdU4uPVR/Y/jI oGElFHVH/nYfHAWRndUwNU9n08H/QF0WWQEFbxyq8ZkDdM4h7kulo2i4UA53Knb3HI8L 2ES6u2HguCBcgJWn4pwK2axBldDj/H4MceXOA=
MIME-Version 1.0
In-Reply-To <4D9C36A90200001B00002FFE@smtp.nfra.nl>
References <4D9523EF0200001B00016CE4@smtp.nfra.nl> <AANLkTin+sKL_-JaTeTRGpHsGKC2ERukEM+VsqMqOG-8X@mail.gmail.com> <4D9C36A90200001B00002FFE@smtp.nfra.nl>
Date Wed, 6 Apr 2011 10:43:19 -0700
Subject Re: Behaviour of subprocess.Popen, ssh and nohup I don't understand
From Dan Stromberg <drsalists@gmail.com>
To Adriaan Renting <renting@astron.nl>
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.82.1302111802.9059.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 82.94.164.166
X-Trace 1302111802 news.xs4all.nl 41102 [::ffff:82.94.164.166]:59063
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2714

Show key headers only | View raw


On Wed, Apr 6, 2011 at 12:47 AM, Adriaan Renting <renting@astron.nl> wrote:
>
>
> This solves the problem using stdin=open(os.devnull, 'rb') instead of
> stdin=None makes it run even if there is input from stdin in the
> foreground process.
>
> The operating system is Ubuntu 8.04
> I understood what Suspended (tty input) means. I don't understand why
> it waits for input if stdin=None.
>
> Thank you for your help.
>
> Adriaan Renting.
> --
> http://mail.python.org/mailman/listinfo/python-list

http://docs.python.org/library/subprocess.html
"With None, no redirection will occur; the child’s file handles will
be inherited from the parent."

When a background process reads from a tty (which is most likely what
its inherited stdin is connected to), it gets a SIGTTIN, suspending
your background process.

See also "ssh -n".

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


Thread

Re: Behaviour of subprocess.Popen, ssh and nohup I don't understand Dan Stromberg <drsalists@gmail.com> - 2011-04-06 10:43 -0700

csiph-web