feat(executiontime): support execution time measurement in terminals with pwsh#7381
feat(executiontime): support execution time measurement in terminals with pwsh#7381heaths wants to merge 1 commit intoJanDeDobbeleer:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds PowerShell (pwsh) shell-integration support for emitting the FTCS_COMMAND_EXECUTED (OSC 133;C) VT sequence so terminals (e.g., Ghostty) can correctly measure command execution time, aligning behavior with existing bash/zsh/fish patterns.
Changes:
- Hooks
PSConsoleHostReadLineto emit OSC 133;C at the start of command execution. - Extracts OSC 133;C emission into a reusable
Write-CommandExecutedhelper and reuses it in the Enter key handler. - Restores the original
PSConsoleHostReadLinefunction during module cleanup.
Resolves JanDeDobbeleer#7377 by writing the FTCS_COMMAND_EXECUTED (OSC 133;C) VT sequence that some terminals support to measure execution time. Follows similar pattern as bash support. Replaces streaming-only write of OSC 133;C added in JanDeDobbeleer#3842.
|
@JanDeDobbeleer I could update this PR to include Or, if you're open to that change, would you prefer I make it in a separate PR after Ghostty is updated so I can accurately test it? For now, I'm working around it with a change that might be worth considering anyway for other terminals: https://github.com/heaths/profile/blob/8a34c07703944fa315a8b2c4e7dcf780fe836e50/Microsoft.PowerShell_profile.ps1#L42-L49 $line = _omp_host_readline
if (![String]::IsNullOrWhiteSpace($line)) {
# Work around https://github.com/ghostty-org/ghostty/discussions/11477
Write-Host -NoNewline "`e]2;$($line -replace '\p{Cc}', '')`a"
Write-Host -NoNewline "`e]133;C;cmdline_url=$([Uri]::EscapeUriString($line))`a"
}
$lineThat could be considered part of |
Resolves #7377 by writing the
FTCS_COMMAND_EXECUTED(OSC 133;C) VT sequence that some terminals support to measure execution time.Follows similar pattern as bash support.