Arksine
d9edcd9396
shell_command: Add "quiet" argument to run_with_response
...
This reduces logging when "run_with_response" is called from a loop or a timer.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-03-04 08:45:31 -05:00
Arksine
22a5f6720c
shell_command: reset internal proc state in "run_with_response"
...
This sets a clean state should a shell command be run more than once.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-03-04 08:45:31 -05:00
Arksine
75dce0af1a
shell_command: refactor using asyncio
...
At times a subprocess created by shell command fails. Attempt to mitigate this by using asyncio's version of subprocess, which should be more stable when running via the event loop.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-02-27 12:55:18 -05:00
Arksine
c261ee51f3
shell_command: Add retries to "run_with_response" method
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2021-01-01 20:52:46 -05:00
Arksine
34af0b4bfb
shell_command: always log the result of a shell command
...
Use the return code to help determine if the command successfully finished.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-12-30 11:53:27 -05:00
Arksine
b5394228ef
shell_command: reset tracking attributes in run()
...
Clear partial output and cancelled attributes prior to each call of run(). This allows a command to be cleanly run again after a failure.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-12-30 11:53:27 -05:00
Arksine
2e44766e1e
shell_command: check the return code of the proc for success
...
Add a "get_return_code" method that allows users to fetch the return code after the shell command has executed.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-11-29 12:12:58 -05:00
Arksine
8678e25427
shell_command: return False if an exception is raised
...
Signed-off- by: Eric Callahan <arksine.code@gmail.com>
2020-11-29 06:36:34 -05:00
Arksine
093b8c14d6
shell_command: refactor output parsing
...
Separate output by line, and execute the output callback once per line.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-11-23 06:22:56 -05:00
Arksine
116c1e9f29
shell_command: add run_with_response() method
...
This method collects the entire response and returns it with the call. Suitable for commands that produce little output.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-11-23 06:22:56 -05:00
Arksine
6905515f3d
shell_command: add ability to cancel a running process
...
Also adds an indefinite timeout if the timeout is specified as "None".
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-09-26 06:14:35 -04:00
Arksine
7cd22804dd
moonraker: replace legacy string interpolation with f-strings
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-08-11 14:28:41 -04:00
Arksine
470cc13b0e
shell_command: Add configparser support
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-08-11 08:38:28 -04:00
Arksine
1baa85d109
shell_command: Fix logging
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-07-14 07:22:19 -04:00
Arksine
d1c740b900
moonraker: add initial source
...
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
2020-07-02 12:24:15 -04:00