changeset: 2738:1b00b9223ab2
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Sun Jun 20 16:37:17 2010 -0400
files: alternative_wmiircs/python/pygmi/util.py
description:
[python] Call background programs with stdin=/dev/null.
diff -r f0a80512c1f4 -r 1b00b9223ab2 alternative_wmiircs/python/pygmi/util.py
--- a/alternative_wmiircs/python/pygmi/util.py Sun Jun 20 15:59:27 2010 -0400
+++ b/alternative_wmiircs/python/pygmi/util.py Sun Jun 20 16:37:17 2010 -0400
@@ -11,9 +11,10 @@
def call(*args, **kwargs):
background = kwargs.pop('background', False)
+ stdin = subprocess.PIPE if not background else open('/dev/null', 'r')
pipe = subprocess.PIPE if not background else None
input = kwargs.pop('input', None)
- p = subprocess.Popen(args, stdin=pipe, stdout=pipe, stderr=pipe,
+ p = subprocess.Popen(args, stdin=stdin, stdout=pipe, stderr=pipe,
preexec_fn=lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL),
cwd=os.environ['HOME'], close_fds=True, **kwargs)
if not background:
Received on Sun Jun 20 2010 - 20:37:25 UTC
This archive was generated by hypermail 2.2.0 : Sun Jun 20 2010 - 20:48:04 UTC