From 6df444cf33a251f5dcb536606b44af696cdb4ed5 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 2 Dec 2017 00:43:21 +0800 Subject: [PATCH] ceph-volume: process: disable stdin param of run() 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 --- src/ceph-volume/ceph_volume/process.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/ceph-volume/ceph_volume/process.py b/src/ceph-volume/ceph_volume/process.py index 4b6a9c284741f..7bc97a99b2039 100644 --- a/src/ceph-volume/ceph_volume/process.py +++ b/src/ceph-volume/ceph_volume/process.py @@ -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()], -- 2.39.5