[IronPython] popen should not open new windows.

Jeff Brown Jeff at ingenio.com
Mon Feb 19 08:45:25 CET 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")


More information about the Ironpython-users mailing list