Skip to content

Commit 373c404

Browse files
committed
No longer appending \n to commands run by PyscriptBridge. This messes up redirection parsing
of non-multiline commands.
1 parent 2beb3de commit 373c404

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

cmd2/parsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def tokenize(self, line: str, expand: bool = True) -> List[str]:
372372
line = self._expand(line)
373373

374374
# check if this line is a comment
375-
if line.strip().startswith(constants.COMMENT_CHAR):
375+
if line.lstrip().startswith(constants.COMMENT_CHAR):
376376
return []
377377

378378
# split on whitespace

cmd2/pyscript_bridge.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ def __call__(self, command: str, echo: Optional[bool] = None) -> CommandResult:
9898
self._cmd2_app.stdout = copy_cmd_stdout
9999
with redirect_stdout(copy_cmd_stdout):
100100
with redirect_stderr(copy_stderr):
101-
# Include a newline in case it's a multiline command
102-
self._cmd2_app.onecmd_plus_hooks(command + '\n')
101+
self._cmd2_app.onecmd_plus_hooks(command)
103102
finally:
104103
self._cmd2_app.stdout = copy_cmd_stdout.inner_stream
105104

0 commit comments

Comments
 (0)