commit 0855f12de83ba41bb5376811e00cf7606aed4723
parent 262778dccc67b6f35aa8b5a9f230a327291e8068
Author: Kris Maglione <kris@suckless.org>
Date: Sun, 20 Jun 2010 16:37:17 -0400
[python] Call background programs with stdin=/dev/null.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/alternative_wmiircs/python/pygmi/util.py b/alternative_wmiircs/python/pygmi/util.py
@@ -11,9 +11,10 @@ def _():
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: