From afb9d7417e44dbbcf39c4aafada82eb505c72109 Mon Sep 17 00:00:00 2001 From: Richard Thompson Date: Thu, 31 Jan 2013 11:54:38 +0300 Subject: [PATCH 1/2] commandline append redirection functionality added --- plumbum/commands.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plumbum/commands.py b/plumbum/commands.py index f69a344a8..201d87051 100644 --- a/plumbum/commands.py +++ b/plumbum/commands.py @@ -191,6 +191,10 @@ def __gt__(self, file): """Redirects the process' stdout to the given file""" return StdoutRedirection(self, file) + def __rshift__(self, file): + """Redirects the process' stdout to the given file (appending)""" + return AppendingStdoutRedirection(self, file) + def __ge__(self, file): """Redirects the process' stderr to the given file""" return StderrRedirection(self, file) @@ -421,6 +425,12 @@ class StdoutRedirection(BaseRedirection): KWARG = "stdout" MODE = "w" +class StdoutRedirection(BaseRedirection): + __slots__ = [] + SYM = ">>" + KWARG = "stdout" + MODE = "a" + class StderrRedirection(BaseRedirection): __slots__ = [] SYM = "2>" From aa90a2f76b2230ff0dcdfb7a92dc23ce1bb73e97 Mon Sep 17 00:00:00 2001 From: Richard Thompson Date: Sat, 2 Feb 2013 09:54:20 +0300 Subject: [PATCH 2/2] corrected >> function --- plumbum/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plumbum/commands.py b/plumbum/commands.py index 201d87051..cea2e64e6 100644 --- a/plumbum/commands.py +++ b/plumbum/commands.py @@ -425,7 +425,7 @@ class StdoutRedirection(BaseRedirection): KWARG = "stdout" MODE = "w" -class StdoutRedirection(BaseRedirection): +class AppendingStdoutRedirection(BaseRedirection): __slots__ = [] SYM = ">>" KWARG = "stdout"