From b3b17aceb134c8bd6c88efa13f667e975c9f0460 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 29 Jul 2018 14:30:56 +0300 Subject: Add: OUT and ERR and OUTERR functions to Python actions --- ick2/actions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ick2/actions.py b/ick2/actions.py index 932c1e0..daab0e5 100644 --- a/ick2/actions.py +++ b/ick2/actions.py @@ -228,6 +228,17 @@ class PythonAction(Action): ' if "check" not in kwargs:\n' ' kwargs["check"] = True\n' ' return subprocess.run(args, **kwargs)\n' + 'def OUT(*args, **kwargs):\n' + ' x = RUN(*args, stdout=subprocess.PIPE, **kwargs)\n' + ' return x.stdout.decode("UTF-8")\n' + 'def ERR(*args, **kwargs):\n' + ' x = RUN(*args, stderr=subprocess.PIPE, check=False, **kwargs)\n' + ' return x.stderr.decode("UTF-8")\n' + 'def OUTERR(*args, **kwargs):\n' + ' x = RUN(*args, stdout=subprocess.PIPE, \n' + ' sterr=subproces.STDOUT, check=False, **kwargs)\n' + ' return s.stdout.decode("UTF-8"), x.stderr.decode("UTF-8")\n' + ).format(encoded) return prefix -- cgit v1.2.1