Skip to content

Commit 0d1cfe8

Browse files
authored
Fix backed up command and false exit code (microsoft#23025)
Resolves: microsoft#23016 microsoft#22942
1 parent c548414 commit 0d1cfe8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python_files/pythonrc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ def __str__(self):
5454
result = ""
5555
# For non-windows allow recent_command history.
5656
if sys.platform != "win32":
57-
result = "{command_finished}{prompt_started}{prompt}{command_start}{command_executed}{command_line}".format(
57+
result = "{command_line}{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(
58+
command_line="\x1b]633;E;" + str(get_last_command()) + "\x07",
5859
command_finished="\x1b]633;D;" + str(exit_code) + "\x07",
5960
prompt_started="\x1b]633;A\x07",
6061
prompt=original_ps1,
6162
command_start="\x1b]633;B\x07",
6263
command_executed="\x1b]633;C\x07",
63-
command_line="\x1b]633;E;" + str(get_last_command()) + "\x07",
6464
)
6565
else:
6666
result = "{command_finished}{prompt_started}{prompt}{command_start}{command_executed}".format(

python_files/tests/test_shell_integration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_decoration_success():
1313
if sys.platform != "win32":
1414
assert (
1515
result
16-
== "\x1b]633;D;0\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07\x1b]633;E;None\x07"
16+
== "\x1b]633;E;None\x07\x1b]633;D;0\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07"
1717
)
1818
else:
1919
pass
@@ -28,7 +28,7 @@ def test_decoration_failure():
2828
if sys.platform != "win32":
2929
assert (
3030
result
31-
== "\x1b]633;D;1\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07\x1b]633;E;None\x07"
31+
== "\x1b]633;E;None\x07\x1b]633;D;1\x07\x1b]633;A\x07>>> \x1b]633;B\x07\x1b]633;C\x07"
3232
)
3333
else:
3434
pass

0 commit comments

Comments
 (0)