]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Add "input" handling for cmd_txt_*() pkglib.py.
authorWayne Davison <wayne@opencoder.net>
Sat, 23 May 2020 05:40:54 +0000 (22:40 -0700)
committerWayne Davison <wayne@opencoder.net>
Sat, 23 May 2020 05:49:02 +0000 (22:49 -0700)
packaging/pkglib.py

index 067c5c8e561d168bae6402df2fb37354060b0ea6..08f5c025382ec90a20fef10b15271df5f0142c30 100644 (file)
@@ -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)