From 22206b9a890e433599fc944c21b03959222819ca Mon Sep 17 00:00:00 2001 From: James Date: Fri, 27 Oct 2017 14:33:14 +0100 Subject: [PATCH 01/15] add constants for setting process priority adds the required constants that can be passed to creationflags for Popen to allow setting the process priority on windows. --- Modules/_winapi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 7e8d4e38464077..4c8240ed66957f 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -1595,6 +1595,13 @@ PyInit__winapi(void) WINAPI_CONSTANT(F_DWORD, WAIT_OBJECT_0); WINAPI_CONSTANT(F_DWORD, WAIT_ABANDONED_0); WINAPI_CONSTANT(F_DWORD, WAIT_TIMEOUT); + + WINAPI_CONSTANT(F_DWORD, ABOVE_NORMAL_PRIORITY_CLASS); + WINAPI_CONSTANT(F_DWORD, BELOW_NORMAL_PRIORITY_CLASS); + WINAPI_CONSTANT(F_DWORD, HIGH_PRIORITY_CLASS); + WINAPI_CONSTANT(F_DWORD, IDLE_PRIORITY_CLASS); + WINAPI_CONSTANT(F_DWORD, NORMAL_PRIORITY_CLASS); + WINAPI_CONSTANT(F_DWORD, REALTIME_PRIORITY_CLASS); WINAPI_CONSTANT("i", NULL); From 788a08611bc1c612639bc5ec0ca7a1ff1a4c31d7 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 27 Oct 2017 14:36:52 +0100 Subject: [PATCH 02/15] Update subprocess.py --- Lib/subprocess.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py index c7e568fafecae8..c493bf409a92ac 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -164,13 +164,19 @@ def __init__(self, *, dwFlags=0, hStdInput=None, hStdOutput=None, from _winapi import (CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP, STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE, SW_HIDE, - STARTF_USESTDHANDLES, STARTF_USESHOWWINDOW) + STARTF_USESTDHANDLES, STARTF_USESHOWWINDOW, + ABOVE_NORMAL_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, + HIGH_PRIORITY_CLASS, IDLE_PRIORITY_CLASS, + NORMAL_PRIORITY_CLASS, REALTIME_PRIORITY_CLASS) __all__.extend(["CREATE_NEW_CONSOLE", "CREATE_NEW_PROCESS_GROUP", "STD_INPUT_HANDLE", "STD_OUTPUT_HANDLE", "STD_ERROR_HANDLE", "SW_HIDE", "STARTF_USESTDHANDLES", "STARTF_USESHOWWINDOW", - "STARTUPINFO"]) + "STARTUPINFO", + "ABOVE_NORMAL_PRIORITY_CLASS", "BELOW_NORMAL_PRIORITY_CLASS", + "HIGH_PRIORITY_CLASS", "IDLE_PRIORITY_CLASS", + "NORMAL_PRIORITY_CLASS", "REALTIME_PRIORITY_CLASS"]) class Handle(int): closed = False From 0b3e80554f2976172758fac07c6d9fab4d2e1bea Mon Sep 17 00:00:00 2001 From: James Date: Fri, 27 Oct 2017 15:04:58 +0100 Subject: [PATCH 03/15] Create 2017-10-27.bpo-31884.bjhre9.rst --- Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst diff --git a/Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst b/Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst new file mode 100644 index 00000000000000..cbadb051bf3fa5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst @@ -0,0 +1 @@ +added required constants to subprocess module for setting priotity on windows From bdaf817bb9545958fd31a29d1f64962c581c5d92 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 30 Oct 2017 10:33:31 +0000 Subject: [PATCH 04/15] added constants added: CREATE_NO_WINDOW (allocate a console without a window) DETACHED_PROCESS (do not inherit or allocate a console) CREATE_DEFAULT_ERROR_MODE CREATE_BREAKAWAY_FROM_JOB --- Modules/_winapi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 4c8240ed66957f..0a1d139cd0e075 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -1602,6 +1602,11 @@ PyInit__winapi(void) WINAPI_CONSTANT(F_DWORD, IDLE_PRIORITY_CLASS); WINAPI_CONSTANT(F_DWORD, NORMAL_PRIORITY_CLASS); WINAPI_CONSTANT(F_DWORD, REALTIME_PRIORITY_CLASS); + + WINAPI_CONSTANT(F_DWORD, CREATE_NO_WINDOW); + WINAPI_CONSTANT(F_DWORD, DETACHED_PROCESS); + WINAPI_CONSTANT(F_DWORD, CREATE_DEFAULT_ERROR_MODE); + WINAPI_CONSTANT(F_DWORD, CREATE_BREAKAWAY_FROM_JOB); WINAPI_CONSTANT("i", NULL); From f9726582e0eb97019c856cfeb9ac8eb9e634dd69 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 30 Oct 2017 10:34:45 +0000 Subject: [PATCH 05/15] added constants CREATE_NO_WINDOW (allocate a console without a window) DETACHED_PROCESS (do not inherit or allocate a console) CREATE_DEFAULT_ERROR_MODE CREATE_BREAKAWAY_FROM_JOB --- Lib/subprocess.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py index c493bf409a92ac..beea09cc8a6189 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -176,7 +176,9 @@ def __init__(self, *, dwFlags=0, hStdInput=None, hStdOutput=None, "STARTUPINFO", "ABOVE_NORMAL_PRIORITY_CLASS", "BELOW_NORMAL_PRIORITY_CLASS", "HIGH_PRIORITY_CLASS", "IDLE_PRIORITY_CLASS", - "NORMAL_PRIORITY_CLASS", "REALTIME_PRIORITY_CLASS"]) + "NORMAL_PRIORITY_CLASS", "REALTIME_PRIORITY_CLASS", + "CREATE_NO_WINDOW", "DETACHED_PROCESS", + "CREATE_DEFAULT_ERROR_MODE", "CREATE_BREAKAWAY_FROM_JOB"]) class Handle(int): closed = False From 55ace1551feec871155626bdb5b7ab653baff3c7 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 7 Nov 2017 12:10:57 +0000 Subject: [PATCH 06/15] fixed missing import --- Lib/subprocess.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py index beea09cc8a6189..6a874c225bcdf3 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -167,7 +167,9 @@ def __init__(self, *, dwFlags=0, hStdInput=None, hStdOutput=None, STARTF_USESTDHANDLES, STARTF_USESHOWWINDOW, ABOVE_NORMAL_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS, IDLE_PRIORITY_CLASS, - NORMAL_PRIORITY_CLASS, REALTIME_PRIORITY_CLASS) + NORMAL_PRIORITY_CLASS, REALTIME_PRIORITY_CLASS, + CREATE_NO_WINDOW, DETACHED_PROCESS, + CREATE_DEFAULT_ERROR_MODE, CREATE_BREAKAWAY_FROM_JOB) __all__.extend(["CREATE_NEW_CONSOLE", "CREATE_NEW_PROCESS_GROUP", "STD_INPUT_HANDLE", "STD_OUTPUT_HANDLE", From 13f08930bcf4baba4efd7c9a14f447ffb7766922 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 7 Nov 2017 12:38:53 +0000 Subject: [PATCH 07/15] Update subprocess.rst --- Doc/library/subprocess.rst | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 693355cce7f93d..de47ef91ba419e 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -516,8 +516,24 @@ functions. If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is passed to the underlying ``CreateProcess`` function. - *creationflags*, if given, can be :data:`CREATE_NEW_CONSOLE` or - :data:`CREATE_NEW_PROCESS_GROUP`. (Windows only) + *creationflags*, if given, can be + :: + :data:`CREATE_NEW_CONSOLE` + :data:`CREATE_NEW_PROCESS_GROUP` + + .. versionadded:: 3.7 + added windows process creation flags + :data:`ABOVE_NORMAL_PRIORITY_CLASS` + :data:`BELOW_NORMAL_PRIORITY_CLASS` + :data:`HIGH_PRIORITY_CLASS` + :data:`IDLE_PRIORITY_CLASS` + :data:`NORMAL_PRIORITY_CLASS` + :data:`REALTIME_PRIORITY_CLASS` + :data:`CREATE_NO_WINDOW` + :data:`DETACHED_PROCESS` + :data:`CREATE_DEFAULT_ERROR_MODE` + :data:`CREATE_BREAKAWAY_FROM_JOB` + Popen objects are supported as context managers via the :keyword:`with` statement: on exit, standard file descriptors are closed, and the process is waited for. From 382f890cb02c5b427a72ab1e0df70af3b51e1aec Mon Sep 17 00:00:00 2001 From: James Date: Tue, 7 Nov 2017 12:50:44 +0000 Subject: [PATCH 08/15] Update subprocess.rst --- Doc/library/subprocess.rst | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index de47ef91ba419e..afd17ca89706e1 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -866,7 +866,64 @@ The :mod:`subprocess` module exposes the following constants. on the subprocess. This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. + +.. data:: ABOVE_NORMAL_PRIORITY_CLASS + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an above average priority. + +.. data:: BELOW_NORMAL_PRIORITY_CLASS + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have a below average priority. + +.. data:: HIGH_PRIORITY_CLASS + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have a high priority. + +.. data:: IDLE_PRIORITY_CLASS + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an idle (lowest) priority. + +.. data:: NORMAL_PRIORITY_CLASS + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an normal priority. (default) + +.. data:: REALTIME_PRIORITY_CLASS + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have realtime priority. + You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts + system threads that manage mouse input, keyboard input, and background disk + flushing. This class can be appropriate for applications that "talk" directly + to hardware or that perform brief tasks that should have limited interruptions. + +.. data:: CREATE_NO_WINDOW + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will not create a window + +.. data:: DETACHED_PROCESS + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will not inherit its parent's console. + This value cannot be used with CREATE_NEW_CONSOLE. + +.. data:: CREATE_DEFAULT_ERROR_MODE + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + does not inherit the error mode of the calling process. Instead, the new + process gets the default error mode. + This feature is particularly useful for multithreaded shell applications + that run with hard errors disabled. + +.. data:: CREATE_BREAKAWAY_FROM_JOB + + A :class:`Popen` ``creationflags`` parameter to specify that a new process + is not associated with the job. .. _call-function-trio: Older high-level API From 197861fc93ada9e60ee1daa1ac5c98372c306cdd Mon Sep 17 00:00:00 2001 From: James Date: Tue, 7 Nov 2017 15:37:10 +0000 Subject: [PATCH 09/15] Update subprocess.rst --- Doc/library/subprocess.rst | 84 +++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index afd17ca89706e1..1840a3ad216d8d 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -517,12 +517,8 @@ functions. If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is passed to the underlying ``CreateProcess`` function. *creationflags*, if given, can be - :: - :data:`CREATE_NEW_CONSOLE` - :data:`CREATE_NEW_PROCESS_GROUP` - - .. versionadded:: 3.7 - added windows process creation flags + :data:`CREATE_NEW_CONSOLE` + :data:`CREATE_NEW_PROCESS_GROUP` :data:`ABOVE_NORMAL_PRIORITY_CLASS` :data:`BELOW_NORMAL_PRIORITY_CLASS` :data:`HIGH_PRIORITY_CLASS` @@ -855,65 +851,75 @@ The :mod:`subprocess` module exposes the following constants. additional information. .. data:: CREATE_NEW_CONSOLE - - The new process has a new console, instead of inheriting its parent's - console (the default). + + The new process has a new console, instead of inheriting its parent's + console (the default). .. data:: CREATE_NEW_PROCESS_GROUP + + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + group will be created. This flag is necessary for using :func:`os.kill` + on the subprocess. - A :class:`Popen` ``creationflags`` parameter to specify that a new process - group will be created. This flag is necessary for using :func:`os.kill` - on the subprocess. - - This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. - + This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. + .. data:: ABOVE_NORMAL_PRIORITY_CLASS - - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have an above average priority. + + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an above average priority. .. data:: BELOW_NORMAL_PRIORITY_CLASS - - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have a below average priority. + + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have a below average priority. .. data:: HIGH_PRIORITY_CLASS - - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have a high priority. + + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have a high priority. .. data:: IDLE_PRIORITY_CLASS - - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have an idle (lowest) priority. + + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an idle (lowest) priority. .. data:: NORMAL_PRIORITY_CLASS - - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have an normal priority. (default) + + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an normal priority. (default) .. data:: REALTIME_PRIORITY_CLASS - - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have realtime priority. - You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts - system threads that manage mouse input, keyboard input, and background disk - flushing. This class can be appropriate for applications that "talk" directly - to hardware or that perform brief tasks that should have limited interruptions. + + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have realtime priority. + You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts + system threads that manage mouse input, keyboard input, and background disk + flushing. This class can be appropriate for applications that "talk" directly + to hardware or that perform brief tasks that should have limited interruptions. .. data:: CREATE_NO_WINDOW + .. versionadded:: 3.7 A :class:`Popen` ``creationflags`` parameter to specify that a new process will not create a window .. data:: DETACHED_PROCESS + .. versionadded:: 3.7 A :class:`Popen` ``creationflags`` parameter to specify that a new process will not inherit its parent's console. This value cannot be used with CREATE_NEW_CONSOLE. .. data:: CREATE_DEFAULT_ERROR_MODE + .. versionadded:: 3.7 A :class:`Popen` ``creationflags`` parameter to specify that a new process does not inherit the error mode of the calling process. Instead, the new process gets the default error mode. @@ -921,9 +927,11 @@ The :mod:`subprocess` module exposes the following constants. that run with hard errors disabled. .. data:: CREATE_BREAKAWAY_FROM_JOB - + + .. versionadded:: 3.7 A :class:`Popen` ``creationflags`` parameter to specify that a new process is not associated with the job. + .. _call-function-trio: Older high-level API From 2ccf78763c794d50930daeb4acddd75823e90ffc Mon Sep 17 00:00:00 2001 From: James Date: Tue, 7 Nov 2017 15:42:30 +0000 Subject: [PATCH 10/15] Update subprocess.rst --- Doc/library/subprocess.rst | 90 +++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 1840a3ad216d8d..9826b21dd7ae79 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -852,85 +852,85 @@ The :mod:`subprocess` module exposes the following constants. .. data:: CREATE_NEW_CONSOLE - The new process has a new console, instead of inheriting its parent's - console (the default). + The new process has a new console, instead of inheriting its parent's + console (the default). .. data:: CREATE_NEW_PROCESS_GROUP - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - group will be created. This flag is necessary for using :func:`os.kill` - on the subprocess. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + group will be created. This flag is necessary for using :func:`os.kill` + on the subprocess. - This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. + This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. .. data:: ABOVE_NORMAL_PRIORITY_CLASS - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have an above average priority. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an above average priority. .. data:: BELOW_NORMAL_PRIORITY_CLASS - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have a below average priority. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have a below average priority. .. data:: HIGH_PRIORITY_CLASS - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have a high priority. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have a high priority. .. data:: IDLE_PRIORITY_CLASS - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have an idle (lowest) priority. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an idle (lowest) priority. .. data:: NORMAL_PRIORITY_CLASS - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have an normal priority. (default) + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have an normal priority. (default) .. data:: REALTIME_PRIORITY_CLASS - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have realtime priority. - You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts - system threads that manage mouse input, keyboard input, and background disk - flushing. This class can be appropriate for applications that "talk" directly - to hardware or that perform brief tasks that should have limited interruptions. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will have realtime priority. + You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts + system threads that manage mouse input, keyboard input, and background disk + flushing. This class can be appropriate for applications that "talk" directly + to hardware or that perform brief tasks that should have limited interruptions. .. data:: CREATE_NO_WINDOW - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will not create a window + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will not create a window .. data:: DETACHED_PROCESS - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - will not inherit its parent's console. - This value cannot be used with CREATE_NEW_CONSOLE. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + will not inherit its parent's console. + This value cannot be used with CREATE_NEW_CONSOLE. .. data:: CREATE_DEFAULT_ERROR_MODE - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - does not inherit the error mode of the calling process. Instead, the new - process gets the default error mode. - This feature is particularly useful for multithreaded shell applications - that run with hard errors disabled. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + does not inherit the error mode of the calling process. Instead, the new + process gets the default error mode. + This feature is particularly useful for multithreaded shell applications + that run with hard errors disabled. .. data:: CREATE_BREAKAWAY_FROM_JOB - .. versionadded:: 3.7 - A :class:`Popen` ``creationflags`` parameter to specify that a new process - is not associated with the job. + .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process + is not associated with the job. .. _call-function-trio: From 680efd7bc970a813dd1491d4f5fe5eeb689821e2 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 7 Nov 2017 15:49:46 +0000 Subject: [PATCH 11/15] Update subprocess.rst --- Doc/library/subprocess.rst | 75 ++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 9826b21dd7ae79..ca95241548809b 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -851,87 +851,100 @@ The :mod:`subprocess` module exposes the following constants. additional information. .. data:: CREATE_NEW_CONSOLE - + The new process has a new console, instead of inheriting its parent's console (the default). -.. data:: CREATE_NEW_PROCESS_GROUP - .. versionadded:: 3.7 + +.. data:: CREATE_NEW_PROCESS_GROUP + A :class:`Popen` ``creationflags`` parameter to specify that a new process group will be created. This flag is necessary for using :func:`os.kill` on the subprocess. This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. - -.. data:: ABOVE_NORMAL_PRIORITY_CLASS - + .. versionadded:: 3.7 + +.. data:: ABOVE_NORMAL_PRIORITY_CLASS + A :class:`Popen` ``creationflags`` parameter to specify that a new process will have an above average priority. - -.. data:: BELOW_NORMAL_PRIORITY_CLASS - + .. versionadded:: 3.7 + +.. data:: BELOW_NORMAL_PRIORITY_CLASS + A :class:`Popen` ``creationflags`` parameter to specify that a new process will have a below average priority. - -.. data:: HIGH_PRIORITY_CLASS - + .. versionadded:: 3.7 + +.. data:: HIGH_PRIORITY_CLASS + A :class:`Popen` ``creationflags`` parameter to specify that a new process will have a high priority. - -.. data:: IDLE_PRIORITY_CLASS - + .. versionadded:: 3.7 + +.. data:: IDLE_PRIORITY_CLASS + A :class:`Popen` ``creationflags`` parameter to specify that a new process will have an idle (lowest) priority. - -.. data:: NORMAL_PRIORITY_CLASS - + .. versionadded:: 3.7 + +.. data:: NORMAL_PRIORITY_CLASS + A :class:`Popen` ``creationflags`` parameter to specify that a new process will have an normal priority. (default) - -.. data:: REALTIME_PRIORITY_CLASS - + .. versionadded:: 3.7 + +.. data:: REALTIME_PRIORITY_CLASS + A :class:`Popen` ``creationflags`` parameter to specify that a new process will have realtime priority. You should almost never use REALTIME_PRIORITY_CLASS, because this interrupts system threads that manage mouse input, keyboard input, and background disk flushing. This class can be appropriate for applications that "talk" directly to hardware or that perform brief tasks that should have limited interruptions. + + .. versionadded:: 3.7 .. data:: CREATE_NO_WINDOW - - .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process will not create a window + + .. versionadded:: 3.7 .. data:: DETACHED_PROCESS - - .. versionadded:: 3.7 + A :class:`Popen` ``creationflags`` parameter to specify that a new process will not inherit its parent's console. This value cannot be used with CREATE_NEW_CONSOLE. - -.. data:: CREATE_DEFAULT_ERROR_MODE - + .. versionadded:: 3.7 + +.. data:: CREATE_DEFAULT_ERROR_MODE + A :class:`Popen` ``creationflags`` parameter to specify that a new process does not inherit the error mode of the calling process. Instead, the new process gets the default error mode. This feature is particularly useful for multithreaded shell applications that run with hard errors disabled. -.. data:: CREATE_BREAKAWAY_FROM_JOB - .. versionadded:: 3.7 + +.. data:: CREATE_BREAKAWAY_FROM_JOB + A :class:`Popen` ``creationflags`` parameter to specify that a new process is not associated with the job. - + + .. versionadded:: 3.7 + .. _call-function-trio: Older high-level API From 5114f8ccf80d2c7b6579a562e4cdf295a773caf7 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 7 Nov 2017 15:54:29 +0000 Subject: [PATCH 12/15] Update subprocess.rst --- Doc/library/subprocess.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index ca95241548809b..d252800aff5ef2 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -517,18 +517,18 @@ functions. If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is passed to the underlying ``CreateProcess`` function. *creationflags*, if given, can be - :data:`CREATE_NEW_CONSOLE` - :data:`CREATE_NEW_PROCESS_GROUP` - :data:`ABOVE_NORMAL_PRIORITY_CLASS` - :data:`BELOW_NORMAL_PRIORITY_CLASS` - :data:`HIGH_PRIORITY_CLASS` - :data:`IDLE_PRIORITY_CLASS` - :data:`NORMAL_PRIORITY_CLASS` - :data:`REALTIME_PRIORITY_CLASS` - :data:`CREATE_NO_WINDOW` - :data:`DETACHED_PROCESS` - :data:`CREATE_DEFAULT_ERROR_MODE` - :data:`CREATE_BREAKAWAY_FROM_JOB` + * :data:`CREATE_NEW_CONSOLE` + * :data:`CREATE_NEW_PROCESS_GROUP` + * :data:`ABOVE_NORMAL_PRIORITY_CLASS` + * :data:`BELOW_NORMAL_PRIORITY_CLASS` + * :data:`HIGH_PRIORITY_CLASS` + * :data:`IDLE_PRIORITY_CLASS` + * :data:`NORMAL_PRIORITY_CLASS` + * :data:`REALTIME_PRIORITY_CLASS` + * :data:`CREATE_NO_WINDOW` + * :data:`DETACHED_PROCESS` + * :data:`CREATE_DEFAULT_ERROR_MODE` + * :data:`CREATE_BREAKAWAY_FROM_JOB` Popen objects are supported as context managers via the :keyword:`with` statement: From 8d3fac6669a245185ff31af01fa4956dc12b3e46 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 8 Nov 2017 13:24:51 +0000 Subject: [PATCH 13/15] Update subprocess.rst --- Doc/library/subprocess.rst | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index d252800aff5ef2..146a5cc4efede3 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -516,7 +516,8 @@ functions. If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is passed to the underlying ``CreateProcess`` function. - *creationflags*, if given, can be + *creationflags*, if given, can be one or more of the following flags: + * :data:`CREATE_NEW_CONSOLE` * :data:`CREATE_NEW_PROCESS_GROUP` * :data:`ABOVE_NORMAL_PRIORITY_CLASS` @@ -529,7 +530,6 @@ functions. * :data:`DETACHED_PROCESS` * :data:`CREATE_DEFAULT_ERROR_MODE` * :data:`CREATE_BREAKAWAY_FROM_JOB` - Popen objects are supported as context managers via the :keyword:`with` statement: on exit, standard file descriptors are closed, and the process is waited for. @@ -815,7 +815,7 @@ on Windows. :class:`Popen` is called with ``shell=True``. -Constants +Windows Constants ^^^^^^^^^ The :mod:`subprocess` module exposes the following constants. @@ -855,8 +855,6 @@ The :mod:`subprocess` module exposes the following constants. The new process has a new console, instead of inheriting its parent's console (the default). - .. versionadded:: 3.7 - .. data:: CREATE_NEW_PROCESS_GROUP A :class:`Popen` ``creationflags`` parameter to specify that a new process @@ -865,8 +863,6 @@ The :mod:`subprocess` module exposes the following constants. This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified. - .. versionadded:: 3.7 - .. data:: ABOVE_NORMAL_PRIORITY_CLASS A :class:`Popen` ``creationflags`` parameter to specify that a new process @@ -912,14 +908,14 @@ The :mod:`subprocess` module exposes the following constants. to hardware or that perform brief tasks that should have limited interruptions. .. versionadded:: 3.7 - + .. data:: CREATE_NO_WINDOW A :class:`Popen` ``creationflags`` parameter to specify that a new process will not create a window .. versionadded:: 3.7 - + .. data:: DETACHED_PROCESS A :class:`Popen` ``creationflags`` parameter to specify that a new process From 264fb12ebf61567b248a567ee972f4b6ba56f39f Mon Sep 17 00:00:00 2001 From: James Date: Wed, 8 Nov 2017 13:30:43 +0000 Subject: [PATCH 14/15] Update subprocess.rst --- Doc/library/subprocess.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 146a5cc4efede3..9dabdaef79c8b0 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -517,7 +517,7 @@ functions. If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is passed to the underlying ``CreateProcess`` function. *creationflags*, if given, can be one or more of the following flags: - + * :data:`CREATE_NEW_CONSOLE` * :data:`CREATE_NEW_PROCESS_GROUP` * :data:`ABOVE_NORMAL_PRIORITY_CLASS` From 0765c90d307f2778dae15b1648f73c8a9a65c3d8 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 8 Nov 2017 13:53:10 +0000 Subject: [PATCH 15/15] fixed underline too short --- Doc/library/subprocess.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 9dabdaef79c8b0..a2c184a0460888 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -816,7 +816,7 @@ on Windows. Windows Constants -^^^^^^^^^ +^^^^^^^^^^^^^^^^^ The :mod:`subprocess` module exposes the following constants.