Skip to content

Commit

Permalink
ceph-volume: process: disable stdin param of run()
Browse files Browse the repository at this point in the history
we cannot use process.communicate() to feed the Popen with input,
because, upon return of process.communicate() the stdout,stderr are
closed. see https://docs.python.org/2/library/subprocess.html#subprocess.Popen.communicate .

Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Dec 4, 2017
1 parent 46abd50 commit 6df444c
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/ceph-volume/ceph_volume/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,18 @@ def run(command, **kw):
"""
stop_on_error = kw.pop('stop_on_error', True)
command_msg = obfuscate(command, kw.pop('obfuscate', None))
stdin = kw.pop('stdin', None)
logger.info(command_msg)
terminal.write(command_msg)
terminal_logging = kw.pop('terminal_logging', True)

process = subprocess.Popen(
command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True,
**kw
)

if stdin:
process.communicate(stdin)
while True:
reads, _, _ = select(
[process.stdout.fileno(), process.stderr.fileno()],
Expand Down

0 comments on commit 6df444c

Please sign in to comment.