Releases: netinvent/command_runner
Release list
command and conquer them all, nod if you're happy
This release mainly adds process priority settings and a couple of shorthands for other functionality.
Features
- New silent parameter disabling all logger calls except of logging.DEBUG levels
- New on_exit parameter that takes a callback function as argument, convenient when used in a thread
- valid_exit_codes now accept boolean True which means "all" exit codes
- New priority parameter which sets cpu bound process priority to 'low', 'normal' or 'high'
- New io_priority parameter wihhc sets io bound process priority to 'low', 'normal' or 'high'
Fixes
- Fix output capture failure should be an error log instead of debug
- Fix no longer show debug logging for stdout or stderr when empty
command and conquer them all, don't nod
This is a hotfix release for v1.4.0 that mainly targets an encoding issue.
Fixes
command_runner
- Fixes encoding was not honored unless explicitly disabled
- Use standard ping arguments in tests
elevate
- Use
sleepinstead of ping sleep emulation on Linux
Misc
- Update github actions to v3
- Removed python 3.5 and 3.6 from linux test matrix since Github won't provide them anymore
command and conquer them all, with live streams
This is a feature rich release which primary function is to allow background jobs to report live stdout/stderr stream data to your favorite application by using queues or callback functions.
It also fixes a couple of Python 2.7 & PyPy issues.
Features
- command_runner now has a
command_runner_threaded()function which allows to run in background, but stil provide live stdout/stderr stream output via queues/callbacks - Refactor poller mode to allow multiple stdout / stderr stream redirectors
- Passing a queue.Queue() instance to stdout/stderr arguments will fill queue with live stream output
- Passing a function to stdout/stderr arguments will callback said function with live stream output
- Passing a string to stdout/stderr arguments will redirect stream into filename described by string
- Added
split_streamargument which will make command_runner return (exit_code, stdout, stderr) instead of (exit_code, output) tuple - Added
check_intervalargument which decides how much time we sleep between two checks, defaults to 0.05 seconds.
Lowering this improves responsiveness, but increases CPU usage. Default value should be more than reasaonable for most applications - Added
stop_onargument which takes a function, which is called everycheck_intervaland will interrupt execution if it returns True - Added
process_callbackargument which takes a function(process), which is called upon execution with a subprocess.Popen object as argument for optional external process control - Possibility to disable command_runner stream encoding with
encoding=Falseso we get raw output (bytes) - Added more unit tests (stop_on, process_callback, stream callback / queues, to_null_redirections, split_streams)
Fixes
- Fix unix command provided as list didn't work with
shell=True - Fixed more Python 2.7 UnicodedecodeErrors on corner case exceptions catches
- Fixed python 2.7 TimeoutException output can fail with UnicodedecodeError
- Fix Python 2.7 does not have subprocess.DEVNULL
- Ensure output is always None if process didn't return any string on stdout/stderr on Python 2.7
- Fix python 2.7 process.communicate() multiple calls endup without output (non blocking process.poll() needs communicate() when using shell=True)
Misc
- Removed queue usage in monitor mode (needs lesser threads)
- Optimized performance
- Added new exit code -250 when queue/callbacks are used with monitor method or unknown method has been called
- Optimized tests
command & conquer the standard out/err reloaded
This is a maintenance release to address some CI and packaging issues only.
You only need to update if you're experiencing pip install problems under Python 2.7.
command & conquer the standard out/err
Features
This release adds the possibility to disable stdout/stderr capture by adding stdout=False and/or stderr=False parameters on top of the existing file and/or pipe parameters.
Misc
Add python 3.10 to the test matrix
command (threads) & conquer
Minor release
This release adresses some race conditions that happen only under some circonstances with pypy 3.7, where the timeout check thread hasn't yet returned but the process monitor already stops because the process to monitor has finished.
In that case, timeouts were enforced, but the exit code was 137 (corresponding to the exit code of a killed process).
Fixes
- Timeout race condition with pypy 3.7 (!) where sometimes exit code wasn't -254
- Try to use signal.SIGTERM (if exists) to kill a process instead of os API that uses PID in order to prevent possible collision when process is already dead and another process with the same PID exists
Misc
- Tests are now more verbose
- Black formatter is now enforced
- Timeout tests are less strict for some platform delays
command (runner) & conquer
Major release v1.2.0
This release is a major refactor of the stdout capture methods employed within command_runner.
So we jump from v0.7.0 to v1.2.0 since we have a major rework, and minor fixes too.
Since we include a critical fix, everybody is encouraged to migrate to this version.
Critical fixes
- There was a quite rare but annoying issue where the process finished, but there was still output to read in the pipe reader queue, rendering partial outputs. This has been fully refactored, and a test with 2500 rounds of file reading was added
Features
- There are now two distinct methods to capture output
- Spawning a thread to enforce timeouts, and using process.communicate() (monitor method)
- Spawning a thread to readlines from stdout pipe to an output queue, and reading from that output queue while enforcing timeouts (polller method)
- On the fly output (
live_output=True) option is now explicit (uses poller method only) - Returns partial stdout output when timeouts are reached
- Returns partial stdout output when CTRL+C signal is received (only with poller method)
Misc
- Adds a default 16K stdout buffer
- Default command execution timeout is 3600s (1 hour)
- Highly improved tests
- All tests are done for both capture methods
- Timeout tests are more accurate
- Added missing encoding tests
- 2500 rounds of file reading and comparaison are added to detect rare queue read misses
Fixes
- Use process signals in favor of direct os.kill API to avoid potential race conditions when PID is reused too fast
- Allow full process subtree killing on Windows & Linux, hence not blocking multiple commands like
echo "test" && sleep 100 && echo "done"- Windows does not maintain an explicit process subtree, so we runtime walk processes to establish the child processes to kill. Obviously, orphaned processes cannot be killed that way.-
The windows GUI
This is a bugfix release that adresses a problem where Windows GUI applications console output cannot be read properly, preventing the timeout to work, since we're stuck reading.
We introduced a threaded pipe reader, which may be stopped regardless of read state.
Keep it working more
This is a quick maintenance release that mainly streamlines packaging, and also fixes a possible encoding issue where command_runner may fail under Python <=3.4 when running executables within Powershell containing non unicode output.
keep_it_working
This is a simple release that fixes the setup.py issue with Python 2.7.