Re: [RFC] Io\Terminal
| From: | Pratik Bhujel | Date: | Fri, 06 Nov 2026 11:49:26 +0000 |
| Subject: | Re: [RFC] Io\Terminal | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-133026@lists.php.net to get a copy of this message | ||
Hi all,
I've updated the Io\Terminal RFC to version 0.5:
https://wiki.php.net/rfc/io_terminal
It adds examples for raw-mode leases and sequential reads, clarifies
lease restoration, escape-sequence timeouts, resize notifications, and
line endings, and marks enableRawMode() as NoDiscard.
The PR has been updated to match, and its CI checks are green:
https://github.com/php/php-src/pull/23941
As mentioned earlier, I'm holding off on voting while the discussion continues.
Regards,
Pratik
On Fri, 06 Nov 2026 02:43:52 -0800, Pratik Bhujel
<prateekbhujelpb@gmail.com> wrote:
> Hi Tim and Frode,
>
> Thanks for the review, and Frode, thanks for trying the PR in phasync/tui.. I’m holding off
> on opening the vote on November 12.
>
> Tim, your lease examples match the behavior. The last release restores the saved terminal
> attributes on POSIX or the saved input mode on Windows. If the terminal was already raw, that’s
> the state it restores, even if it was changed while the lease was active. Dropping the last
> reference attempts to release the lease. If explicit restoration fails, restoreMode() throws and
> leaves the token active so the caller can retry. I’ve documented the destruction behavior in the
> stub and added NoDiscard to enableRawMode().
>
> A longer sequence timeout is valid: the wait is capped at the remaining overall time.
> readLine() returns the submitted value without the Enter delimiter, like readSecret(), while
> preserving other whitespace. I’d keep Key::Resize for now as a notification to query the size.
>
> Frode, it’s helpful to see raw mode and size used on their own. I’m keeping the reads in
> this revision for small CLI tools that need portable key and hidden input. On a native Windows
> console, readKey() reads console records. The raw-mode lease leaves the existing VT settings alone,
> and Ctrl+C is available as input. I agree that a richer decoder for modifiers, mouse and paste
> deserves its own design.
>
> fromStreams(STDIN, STDOUT) covers the usual CLI case. fromStdio() resolves the current native
> standard handles at operation time; fromStreams() keeps the resources passed in.
>
> The patch is up at https://github.com/php/php-src/pull/23941.
> I’ve prepared examples for the leases and sequential reads, and verified them with a Linux PTY and
> a scripted stream. I’ll announce the RFC revision here once it’s published, before proposing a
> new voting date.
>
> Regards,
> Pratik
>
>
>
>
>
> On Fri, 06 Nov 2026 09:21:48 +0000, Pratik Bhujel <prateekbhujelpb@gmail.com> wrote:
>
>
> > Hi all, I plan to open voting on the Io\Terminal RFC on Thursday, November 12.
> > <https://wiki.php.net/rfc/io_terminal> If you have any
> > remaining concerns, please let me know before then. Regards, Pratik