• Expect for windows takes a turn

    From David Gravereaux@[email protected] to comp.lang.tcl on Sun Sep 7 12:47:13 2025
    From Newsgroup: comp.lang.tcl

    Hi folks,

    I'm trying to update E4W so it builds for WIN64 based on the code used
    by Active State, written by me 20 years ago.

    While reading through the new features of Win10 & 11, I discovered CreatePseudoConsole() which creates a real PTY. Yes, for real, that
    streams VT100 (or converts from the spawned process console API calls)
    across a pipeable stream. Yes, for real.

    As I was reading through this and my head exploded :)

    https://github.com/microsoft/terminal/blob/main/samples/ConPTY/EchoCon/EchoCon/EchoCon.cpp

    I am stopping the Detours work to re-accessing everything. [spawn]
    might be a lot simpler to do now. We already have a pipe channel driver ;)


    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Colin Macleod@[email protected] to comp.lang.tcl on Mon Sep 8 09:05:25 2025
    From Newsgroup: comp.lang.tcl

    David Gravereaux <[email protected]> posted:

    While reading through the new features of Win10 & 11, I discovered CreatePseudoConsole() which creates a real PTY. Yes, for real, that
    streams VT100 (or converts from the spawned process console API calls) across a pipeable stream. Yes, for real.


    That sounds like a real big deal!
    --
    Colin Macleod ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ https://cmacleod.me.uk

    FEED FEED FEED FEED FEED FEED FEED FEED
    GAZA GAZA GAZA GAZA GAZA GAZA GAZA GAZA
    NOW! NOW! NOW! NOW! NOW! NOW! NOW! NOW!
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From gazelle@[email protected] (Kenny McCormack) to comp.lang.tcl on Mon Sep 8 13:06:43 2025
    From Newsgroup: comp.lang.tcl

    In article <109kng4$3srl3$[email protected]>,
    David Gravereaux <[email protected]> wrote:
    Hi folks,

    I'm trying to update E4W so it builds for WIN64 based on the code used
    by Active State, written by me 20 years ago.

    While reading through the new features of Win10 & 11, I discovered >CreatePseudoConsole() which creates a real PTY. Yes, for real, that
    streams VT100 (or converts from the spawned process console API calls) >across a pipeable stream. Yes, for real.

    Does this mean the new version of E4W won't work on earlier versions (less
    than 10) of Windows?

    That'd be a deal-breaker for me.
    --

    "If God wanted us to believe in him, he'd exist."

    (Linda Smith on "10 Funniest Londoners", TimeOut, 23rd June, 2005.)
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@[email protected] to comp.lang.tcl on Mon Sep 8 07:16:56 2025
    From Newsgroup: comp.lang.tcl

    On 9/8/2025 6:06 AM, Kenny McCormack wrote:

    Does this mean the new version of E4W won't work on earlier versions (less than 10) of Windows?

    That'd be a deal-breaker for me.

    I could do both, but the code for it is crazy difficult, and there
    hasn't been a working one for a decade anyways
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@[email protected] to comp.lang.tcl on Mon Sep 8 11:58:10 2025
    From Newsgroup: comp.lang.tcl

    On 9/7/2025 3:47 PM, David Gravereaux wrote:
    Hi folks,

    I'm trying to update E4W so it builds for WIN64 based on the code used
    by Active State, written by me 20 years ago.


    Does this mean 32bit version is out? This would be deal breaker for me.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@[email protected] to comp.lang.tcl on Mon Sep 8 09:03:56 2025
    From Newsgroup: comp.lang.tcl

    On 9/8/2025 6:06 AM, Kenny McCormack wrote:

    That'd be a deal-breaker for me.

    It might be time to let go. To let go of unmanageable, difficult, and "behaves like a virus" code that forces an interface to a system
    behavior that Windows(tm) wasn't designed to offer... until recently.

    It sure was creative, though.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@[email protected] to comp.lang.tcl on Mon Sep 8 09:22:48 2025
    From Newsgroup: comp.lang.tcl

    On 9/8/2025 8:58 AM, saito wrote:

    Does this mean 32bit version is out?  This would be deal breaker for me.

    It is time to drop the ugly and simplify, yes. The method to intercept console API calls in a child process to force a pty behavior is
    unmanageable.

    With CreatePseudoConsole(), [spawn] becomes nearly the same as [exec]
    under the hood.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@[email protected] to comp.lang.tcl on Mon Sep 8 12:25:11 2025
    From Newsgroup: comp.lang.tcl

    On 9/8/2025 12:03 PM, David Gravereaux wrote:
    On 9/8/2025 6:06 AM, Kenny McCormack wrote:

    That'd be a deal-breaker for me.
    "behaves like a virus" code that forces an interface to a system

    I think you believe that the ActiveState version behaves like a virus,
    right? The way I understood it, at the time I was looking into it, it
    was because ActiveState couldn't get a handle to the spawned process
    post Windows 8. To be honest, this always sounded weird to me: an
    operating system would create a new process but not provide details on
    it or make it difficult to get a handle to it. After all, this is what
    an OS does, essentially. So perhaps there was indeed a flaw in the
    design, as you say.

    In any case, this thread uncovered different versions that work fine.
    Perhaps Chatgpt might offer a different solution as well.

    In any case, I wish you goodluck on the project.



    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@[email protected] to comp.lang.tcl on Mon Sep 8 13:22:01 2025
    From Newsgroup: comp.lang.tcl

    On 9/8/2025 9:25 AM, saito wrote:
    ActiveState couldn't get a handle to the spawned process post Windows 8

    No, the process debugger code is fragile and unmanageable with changing interfaces of the dbghelp and imagehlp APIs:

    https://github.com/davygrvy/expect4win/blob/fe6ac711c0ba8e0a4895dedf312188e569983170/win/expWinConsoleDebugger.cpp#L445

    Debugging a process and setting breakpoints on Console API calls is
    ludicrous
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@[email protected] to comp.lang.tcl on Mon Sep 8 13:46:30 2025
    From Newsgroup: comp.lang.tcl

    On 9/8/2025 1:22 PM, David Gravereaux wrote:
    Debugging a process and setting breakpoints on Console API calls is ludicrous

    Even using Detours, which is a much better way to add instrumenting of
    OS API calls, is still crazy. I started on it:

    https://github.com/davygrvy/expect4win/blob/fe6ac711c0ba8e0a4895dedf312188e569983170/win/expWinInjectorMain.cpp#L178

    CreatePseudoConsole() does what we need. Yes, only works on Win 10 >=
    build 1809 and Win11 and server 2019 and greater.

    We will get all this VT100 wonderfulness for free https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Colin Macleod@[email protected] to comp.lang.tcl on Tue Sep 9 08:58:39 2025
    From Newsgroup: comp.lang.tcl

    David Gravereaux <[email protected]> posted:

    On 9/8/2025 8:58 AM, saito wrote:

    Does this mean 32bit version is out?  This would be deal breaker for me.

    It is time to drop the ugly and simplify, yes. The method to intercept console API calls in a child process to force a pty behavior is unmanageable.

    With CreatePseudoConsole(), [spawn] becomes nearly the same as [exec]
    under the hood.

    Might this simplification be enough to let Windows support be merged into
    the standard Expect source?
    --
    Colin Macleod ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ https://cmacleod.me.uk

    FEED FEED FEED FEED FEED FEED FEED FEED
    GAZA GAZA GAZA GAZA GAZA GAZA GAZA GAZA
    NOW! NOW! NOW! NOW! NOW! NOW! NOW! NOW!
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@[email protected] to comp.lang.tcl on Tue Sep 9 18:29:30 2025
    From Newsgroup: comp.lang.tcl

    On 9/9/2025 1:58 AM, Colin Macleod wrote:
    David Gravereaux <[email protected]> posted:
    ...
    With CreatePseudoConsole(), [spawn] becomes nearly the same as [exec]
    under the hood.

    Might this simplification be enough to let Windows support be merged into
    the standard Expect source?

    It should anyway, no matter. It should be a TIP with involvement from
    Don Libes and with more eyes involved than just me and my blinders. My
    code contains C++ due to the complexity and some folks get twitchy about
    that and point to the Tcl style guide.

    That is like step five away from where I am now on reviving this from
    the dead. Two months from now at best?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Don Porter@[email protected] to comp.lang.tcl on Wed Sep 10 09:27:42 2025
    From Newsgroup: comp.lang.tcl

    On 9/9/25 21:29, David Gravereaux wrote:

    It should anyway, no matter.  It should be a TIP ...

    TIPs are for Tcl and Tk. TCT has no authority over Expect.

    ...with involvement from Don Libes...

    Don Libes retired from NIST in 2017. He also left behind responsibility
    over Expect. At the time there was a hand-off to Nils Carlson. It is
    not clear to me whether that handoff was fully effective, or what
    continuing development of Expect has taken place since then.
    --
    | Don Porter Applied and Computational Mathematics Division |
    | [email protected] Information Technology Laboratory |
    | http://math.nist.gov/~DPorter/ NIST | |______________________________________________________________________|
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From David Gravereaux@[email protected] to comp.lang.tcl on Wed Sep 10 21:30:12 2025
    From Newsgroup: comp.lang.tcl

    Thanks Don
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Paul Obermeier@[email protected] to comp.lang.tcl on Thu Sep 11 22:06:12 2025
    From Newsgroup: comp.lang.tcl

    Am 10.09.2025 um 15:27 schrieb Don Porter:
    On 9/9/25 21:29, David Gravereaux wrote:

    It should anyway, no matter.  It should be a TIP ...

    TIPs are for Tcl and Tk.  TCT has no authority over Expect.

    ...with involvement from Don Libes...

    Don Libes retired from NIST in 2017.  He also left behind responsibility over Expect.  At the time there was a hand-off to Nils Carlson.  It is
    not clear to me whether that handoff was fully effective, or what
    continuing development of Expect has taken place since then.

    It seems, Don Libes is still watching the Expect project at SourceForge.
    He posted a comment just a few weeks ago.
    See https://sourceforge.net/projects/expect/

    Paul
    --- Synchronet 3.21a-Linux NewsLink 1.2