OSC 46 Change Log File
Tell xterm which file to log its session to, in a build that can log.
OSC 46 ; Pt ST
xterm can copy everything it receives to a log file, and OSC 46 ; Pt ST names that file. Logging is turned on with the private mode CSI ? 46 h or from xterm’s menu.
Both are compiled out of a default xterm: logging needs --enable-logging (configure.in), and without it OSC 46 is not one of the numbers xterm acts on. Even a build with logging does not let a program choose the file unless it was also built with ALLOWLOGFILECHANGES, since that would let anything written to the terminal overwrite any file its user can; otherwise it rings the bell twice (do_osc).
libghostty-vt has no OSC 46, and ignores it as a default xterm does, so the case passes.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | No | OSC is not among the controls it recognizes (§4.2) |
| VT510 | manual, 1st ed., 1993 | No | ignores an OSC string (chapter 4) |
| xterm | patch 412, xterm-411a | No | compiled out unless built with --enable-logging |
| libghostty-vt | 0f171f6 | No | ignored |
| Konsole | 26.11.70, a24c3d71 | No | not in its source |
| ConEmu | build 230724, its documentation | No | not in its ANSI escape codes |
Validation
OSC46-1: Ignored
A
\e]46;/tmp/session.log\a
B
|AB____|
cursor 1,3
reply none
bell 0