Skip to content

Commit

Permalink
Fix backed up command and false exit code (#23025)
Browse files Browse the repository at this point in the history
Resolves: #23016  #22942
  • Loading branch information
anthonykim1 committed Mar 4, 2024
1 parent c548414 commit 0d1cfe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python_files/pythonrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def __str__(self):
result = ""
# For non-windows allow recent_command history.
if sys.platform != "win32":
result = "{command_finished}{prompt_started}{prompt}{command_start}{command_executed}{command_line}".format(
result = "{command_line}{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(
command_line="\x1b]633;E;" + str(get_last_command()) + "\x07",
command_finished="\x1b]633;D;" + str(exit_code) + "\x07",
prompt_started="\x1b]633;A\x07",
prompt=original_ps1,
command_start="\x1b]633;B\x07",
command_executed="\x1b]633;C\x07",
command_line="\x1b]633;E;" + str(get_last_command()) + "\x07",
)
else:
result = "{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(
Expand Down
4 changes: 2 additions & 2 deletions python_files/tests/test_shell_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_decoration_success():
if sys.platform != "win32":
assert (
result
== "\x1b]633;D;0\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07\x1b]633;E;None\x07"
== "\x1b]633;E;None\x07\x1b]633;D;0\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07"
)
else:
pass
Expand All @@ -28,7 +28,7 @@ def test_decoration_failure():
if sys.platform != "win32":
assert (
result
== "\x1b]633;D;1\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07\x1b]633;E;None\x07"
== "\x1b]633;E;None\x07\x1b]633;D;1\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07"
)
else:
pass
Expand Down

0 comments on commit 0d1cfe8

Please sign in to comment.