subprocess.STARTUPINFO - Serbipunk/notes GitHub Wiki

The STARTUPINFO class and following constants are only available on Windows.

class subprocess.STARTUPINFO

Partial support of the Windows STARTUPINFO structure is used for Popen creation.

dwFlags

    A bit field that determines whether certain STARTUPINFO attributes are used when the process creates a window.

    si = subprocess.STARTUPINFO()
    si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess.STARTF_USESHOWWINDOW

hStdInput

    If dwFlags specifies STARTF_USESTDHANDLES, this attribute is the standard input handle for the process. If STARTF_USESTDHANDLES is not specified, the default for standard input is the keyboard buffer.
    明确设置为STARTF_USETDHANDLES,则该属性使用标准输入具柄。如果没指定,默认输入为键盘buffer。

hStdOutput

    If dwFlags specifies STARTF_USESTDHANDLES, this attribute is the standard output handle for the process. Otherwise, this attribute is ignored and the default for standard output is the console window’s buffer.
    明确设为STARTF_USESTDHANDLES,则该属性置顶标准输出;否则,输出到windows console buffer中。

hStdError

    If dwFlags specifies STARTF_USESTDHANDLES, this attribute is the standard error handle for the process. Otherwise, this attribute is ignored and the default for standard error is the console window’s buffer.

wShowWindow

    If dwFlags specifies STARTF_USESHOWWINDOW, this attribute can be any of the values that can be specified in the nCmdShow parameter for the ShowWindow function, except for SW_SHOWDEFAULT. Otherwise, this attribute is ignored.

    SW_HIDE is provided for this attribute. It is used when Popen is called with shell=True.