mirror of
https://github.com/cmderdev/cmder.git
synced 2025-11-09 21:59:08 +08:00
Add OSC 133;D support for command exit code tracking
Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
This commit is contained in:
8
vendor/profile.ps1
vendored
8
vendor/profile.ps1
vendored
@@ -221,6 +221,14 @@ if ( $(Get-Command prompt).Definition -match 'PS \$\(\$executionContext.SessionS
|
||||
$lastSUCCESS = $?
|
||||
$realLastExitCode = $LastExitCode
|
||||
|
||||
# Emit OSC 133;D sequence for Windows Terminal shell integration
|
||||
# This marks the end of command execution with the exit code
|
||||
# Must be emitted before OSC 133;A (start of next prompt)
|
||||
# Only active in Windows Terminal ($env:WT_SESSION)
|
||||
if ($env:WT_SESSION) {
|
||||
Microsoft.PowerShell.Utility\Write-Host -NoNewline "$([char]0x1B)]133;D;$realLastExitCode$([char]7)"
|
||||
}
|
||||
|
||||
# Emit OSC 9;9 sequence for Windows Terminal directory tracking
|
||||
# This enables "Duplicate Tab" and "Split Pane" to preserve the working directory
|
||||
# Only active in Windows Terminal ($env:WT_SESSION) or ConEmu ($env:ConEmuPID)
|
||||
|
||||
Reference in New Issue
Block a user