Hi Eryk,

thanks a lot for the explanation. It's amazing how Windows does things
differently in so many places ...

> The grandparent and its grandchild will then compete with each other
> for console I/O, which is an interleaved mess. You'll get a prompt
> from the grandparent, but the text you enter will be read by the
> grandchild. Then you'll get the grandchild's prompt, and so on.

Yes, this is exactly what I have been observing so far.

> If you want to reuse the current console session, you'll have to spawn
> ssh, wait for it to exit, and proxy its exit status. That's the
> closest you can get to using exec*() in a POSIX system.

Yes, ideally I'd want to reuse the current console session, but I am
failing at disentangling the "interleaved mess".

> A console session doesn't implement the POSIX concept of foreground
> and background process groups. Any process that's attached to a
> console can read and write from it. Generally when one starts a child
> process in the same console session, one either avoids using console
> I/O until the child exits, or one simply blocks and does nothing while
> waiting for the child to exit. Typically a command-line shell (e.g.
> cmd.exe) implements the latter.

If my Python process was "simply idling" / blocking, `ssh` could do its
thing (fully interactively) in the meantime. Do I understand you
correctly that this can actually be done?

I have done a few dumb experiments along the lines of ...

```python
proc = subprocess.Popen(['ssh', 'user@host'], **parameters)
while proc.poll is None:
    time.sleep(0.25)
```

... but I am not managing to specify `parameters` so that I can actually
interact with `ssh`. Am I on the wrong track ... ?

Best regards,
Sebastian
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to