[Python-Dev] Re: PEP 324 (process module)

Trent Mick trentm at ActiveState.com
Wed Aug 4 20:30:56 CEST 2004


[Peter Astrand wrote]
> > ProcessProxy:
> >     ...a behemoth using a thread for each of stdin/stdout/stderr to
> >     allow the user to get an event-like IO interface.
> 
> Why not avoid threads on POSIX systems, and use select instead? My module
> does, although it does not provide an event-like IO interface. 

Because that wouldn't be cross-platform... perhaps it would be possible
though. I am not that experienced with select() -- I have generally
eschewed it because I can't use it on Windows as well.

> If you get rid of the threads, then you don't need the workaround code
> for Linux.

Slight misunderstanding there: the separate thread from which you cannot
kill a subprocess on Linux is not one of these ProcessProxy threads.
I.e. ignoring ProcessProxy the LinuxThreads-bug workaround is still
necessary for Process and ProcessOpen for the user that starts a
subprocess on their thread-A and wants to kill it on their thread-B.


> You're right. My module should probably have an option for invoking
> through the shell, or at least document how to do it. I really don't want
> it as default, though.

I have code to find the shell adequately so I don't see why we couldn't
use it. As to making it the default or not: perhaps clear documentation
could help avoid the expected "I can't run 'dir'!" newbie complaint, but
I don't think it would get all of the them. The current popen*() execute
via the shell. The lower-level guys, exec*() and spawn*(), do not. Still
up for debate, I guess. :)


> > - My module includes some handling that for subsystem:windows vs.
> >   subsystem:console apps on Windows that I don't think yours does.
> 
> Can you describe why this is needed/useful?

A subsystem:windows app (like Komodo, or Idle, or pythonw.exe, or any
GUI app) doesn't have a console and hence doesn't have std handles. By
default, executing any subsytem:console app (like 'ls' or 'echo' or
'python' or 'perl) from a subsystem:windows app will result in an
AllocConsole call
(TrentM at ActiveState.com


More information about the Python-Dev mailing list

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant