From: Wayne Davison Date: Sat, 23 May 2020 05:40:54 +0000 (-0700) Subject: Add "input" handling for cmd_txt_*() pkglib.py. X-Git-Tag: v3.2.0pre1~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68516f91be8591b3a2d9fc4c9ed5a904e7282265;p=thirdparty%2Frsync.git Add "input" handling for cmd_txt_*() pkglib.py. --- diff --git a/packaging/pkglib.py b/packaging/pkglib.py index 067c5c8e..08f5c025 100644 --- a/packaging/pkglib.py +++ b/packaging/pkglib.py @@ -69,8 +69,11 @@ def cmd_chk(cmd, **opts): # Capture stdout in a string and return the (output, return_code) tuple. # Use capture='combined' opt to get both stdout and stderr together. def cmd_txt_status(cmd, **opts): + input = opts.pop('input', None) + if input is not None: + opts['stdin'] = subprocess.PIPE proc = subprocess.Popen(cmd, **_tweak_opts(cmd, opts, capture='stdout')) - out = proc.communicate()[0] + out = proc.communicate(input=input)[0] return (out, proc.returncode)