[IronPython] popen should not open new windows.

Jeff Brown Jeff at ingenio.com
Sun Feb 18 23:45:25 PST 2007


When calling a process using nt.popen*, the ProcessInfo has the
CreateNoWindow option set to false.  This is fine ordinarily when
working from the command prompt since it seems the current window will
get recycled.  However, when executing within the context of an NT
Service or GUI process what happens is that a new window pops up
whenever popen launches a process.  This is very distracting.

I ended up cooking up this workaround:

# The built-in popen causes windows to pop up whenever a process
# runs since it doesn't set the CreateNoWindow option of the
ProcessInfo.  *sigh*
def QuietPOpen(executable, arguments):
    processStartInfo = ProcessStartInfo(executable, arguments)
    processStartInfo.UseShellExecute = False
    processStartInfo.CreateNoWindow = True
    processStartInfo.RedirectStandardOutput = True
    process = Process.Start(processStartInfo)
    return file(process.StandardOutput.BaseStream, "r")

Jeff.


More information about the users mailing list