Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/ClusterShell/NodeUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
from string import Template
from subprocess import Popen, PIPE

# compat with python 2.7, import directly above for 3.x
try:
from subprocess import DEVNULL
except ImportError:
DEVNULL = open(os.devnull, 'r')

# compat with python 2.7, use str directly in 3.x
try:
basestring
except NameError:
Expand Down Expand Up @@ -202,8 +209,8 @@ def _upcall_read(self, cmdtpl, args=dict()):
"""
cmdline = Template(self.upcalls[cmdtpl]).safe_substitute(args)
self.logger.debug("EXEC '%s'", cmdline)
proc = Popen(cmdline, stdout=PIPE, shell=True, cwd=self.cfgdir,
universal_newlines=True)
proc = Popen(cmdline, stdin=DEVNULL, stdout=PIPE, shell=True,
cwd=self.cfgdir, universal_newlines=True)
output = proc.communicate()[0].strip()
self.logger.debug("READ '%s'", output)
if proc.returncode != 0:
Expand Down
Loading