Skip to content

Commit dbeef11

Browse files
committed
Fix unexpected redirection behavior
New behavior: - help > name with space - redirects to a file called "name" (without the quotes) - help > "name with space" - redirects to a file called "name with space" (without the quotes)
1 parent 7944147 commit dbeef11

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd2/cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,7 @@ def _redirect_output(self, statement):
18401840
# REDIRECTION_APPEND or REDIRECTION_OUTPUT
18411841
if statement.output == constants.REDIRECTION_APPEND:
18421842
mode = 'a'
1843-
sys.stdout = self.stdout = open(os.path.expanduser(statement.output_to), mode)
1843+
sys.stdout = self.stdout = open(os.path.expanduser(shlex.split(statement.output_to)[0]), mode)
18441844
else:
18451845
# going to a paste buffer
18461846
sys.stdout = self.stdout = tempfile.TemporaryFile(mode="w+")

0 commit comments

Comments
 (0)