Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added append redirect functionality #54

Merged
merged 4 commits into from
Feb 8, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions plumbum/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -421,6 +425,12 @@ class StdoutRedirection(BaseRedirection):
KWARG = "stdout"
MODE = "w"

class AppendingStdoutRedirection(BaseRedirection):
__slots__ = []
SYM = ">>"
KWARG = "stdout"
MODE = "a"

class StderrRedirection(BaseRedirection):
__slots__ = []
SYM = "2>"
Expand Down