You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-19Lines changed: 48 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,8 @@ while solving various problems a developer may face among:
16
16
- Allow stdout/stderr stream output to be redirected to callback functions / output queues / files so you get to handle output in your application while commands are running
17
17
- Callback to optional stop check so we can stop execution from outside command_runner
18
18
- Callback with optional process information so we get to control the process from outside command_runner
19
+
- Callback once we're finished to easen thread usage
20
+
- Optional process priority and io_priority settings
19
21
- System agnostic functionality, the developer shouldn't carry the burden of Windows & Linux differences
20
22
- Optional Windows UAC elevation module compatible with CPython, PyInstaller & Nuitka
21
23
- Optional Linux sudo elevation compatible with CPython, PyInstaller & Nuitka
@@ -144,15 +146,26 @@ Be aware that under MS Windows, no direct process tree is available.
144
146
We fixed this by walking processes during runtime. The drawback is that orphaned processes cannot be identified this way.
145
147
146
148
147
-
#### Disabling logs
149
+
#### Disabling logs / silencing
148
150
149
-
Whenever you want another loglevel for command_runner, you might do with the following statement in your code
151
+
`command_runner` has it's own logging system, which will log all sorts of error logs.
152
+
If you need to disable it's logging, just run with argument silent.
153
+
Be aware that logging.DEBUG log levels won't be silenced, by design.
If you also need to disable logging.DEBUG level, you can run the following code which will required logging.CRITICAL only messages which `command_runner` never does:
`command_runner` can set it's subprocess priority to 'low', 'medium' or 'high', which translate to 15, 0, -15 niceness on Linux and BELOW_NORMAL_PRIORITY_CLASS and HIGH_PRIORITY_CLASS in Windows.
@@ -389,34 +428,24 @@ It also uses the following standard arguments:
389
428
- encoding (str/bool): Which text encoding the command produces, defaults to cp437 under Windows and utf-8 under Linux
390
429
- stdout (str/queue.Queue/function/False/None): Optional path to filename where to dump stdout, or queue where to write stdout, or callback function which is called when stdout has output
391
430
- stderr (str/queue.Queue/function/False/None): Optional path to filename where to dump stderr, or queue where to write stderr, or callback function which is called when stderr has output
392
-
- split_streams (bool): Split stdout and stderr into two separate results
393
431
- windows_no_window (bool): Shall a command create a console window (MS Windows only), defaults to False
394
432
- live_output (bool): Print output to stdout while executing command, defaults to False
395
433
- method (str): Accepts 'poller' or 'monitor' stdout capture and timeout monitoring methods
396
434
- check interval (float): Defaults to 0.05 seconds, which is the time between stream readings and timeout checks
397
435
- stop_on (function): Optional function that when returns True stops command_runner execution
436
+
- on_exit (function): Optional function that gets executed when command_runner has finished (callback function)
398
437
- process_callback (function): Optional function that will take command_runner spawned process as argument, in order to deal with process info outside of command_runner
438
+
- split_streams (bool): Split stdout and stderr into two separate results
439
+
- silent (bool): Allows to disable command_runner's internal logs, except for logging.DEBUG levels which for obvious reasons should never be silenced
440
+
- priority (str): Allows to set CPU bound process priority (takes 'low', 'normal' or 'high' parameter)
441
+
- io_priority (str): Allows to set IO priority for process (takes 'low', 'normal' or 'high' parameter)
399
442
- close_fds (bool): Like Popen, defaults to True on Linux and False on Windows
400
443
- universal_newlines (bool): Like Popen, defaults to False
401
444
- creation_flags (int): Like Popen, defaults to 0
402
445
- bufsize (int): Like Popen, defaults to 16384. Line buffering (bufsize=1) is deprecated since Python 3.7
403
446
404
447
**Note that ALL other subprocess.Popen arguments are supported, since they are directly passed to subprocess.**
405
448
406
-
### logging
407
-
408
-
Even muted, `command_runner` will still log errors.
409
-
If you want to completely mute `command_runner`, you will have to set it's logger instance to `logger.CRITICAL` level, since this level is never called.
410
-
411
-
Example of entirely muted `command_runner` execution:
0 commit comments