rich_subproc 1.2.0__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rich_subproc-1.2.0 → rich_subproc-1.2.2}/PKG-INFO +1 -1
- {rich_subproc-1.2.0 → rich_subproc-1.2.2}/pyproject.toml +1 -1
- {rich_subproc-1.2.0 → rich_subproc-1.2.2}/rich_subproc/__init__.py +5 -4
- {rich_subproc-1.2.0 → rich_subproc-1.2.2}/LICENSE +0 -0
- {rich_subproc-1.2.0 → rich_subproc-1.2.2}/README.md +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
1
2
|
"""
|
|
2
3
|
Using Textualize's rich library to pretty print subprocess outputs,
|
|
3
4
|
so during long running commands, the user isn't wondering what's going on,
|
|
4
5
|
even if you don't actually output anything from stdout/stderr of the command.
|
|
5
6
|
|
|
6
|
-
Author: https://jessebot.work
|
|
7
|
+
Author: Jesse Hitch https://jessebot.work
|
|
7
8
|
License: AGPL
|
|
8
9
|
"""
|
|
9
10
|
import logging as log
|
|
@@ -148,11 +149,11 @@ def run_subprocess(command: str, decode_ascii: bool = False, **kwargs):
|
|
|
148
149
|
log.info(res_stderr)
|
|
149
150
|
|
|
150
151
|
# check return code, raise error if failure
|
|
151
|
-
if not
|
|
152
|
+
if type(return_code) is not int or return_code != 0:
|
|
152
153
|
# also scan both stdout and stdin for weird errors
|
|
153
154
|
for output in [res_stdout.lower(), res_stderr.lower()]:
|
|
154
155
|
if 'error' in output:
|
|
155
|
-
err = f'Return code:
|
|
156
|
+
err = f'Return code: {str(return_code)}. Expected code is 0.'
|
|
156
157
|
error_msg = f'\033[0;33m{err}\n{output}\033[00m'
|
|
157
158
|
if error_ok and not quiet:
|
|
158
159
|
log.error(error_msg)
|
|
@@ -196,5 +197,5 @@ def simple_loading_bar(tasks: dict, time_to_wait: int = 120) -> None:
|
|
|
196
197
|
progress.update(task1, completed=time_to_wait)
|
|
197
198
|
sleep(.1)
|
|
198
199
|
break
|
|
199
|
-
print(
|
|
200
|
+
print()
|
|
200
201
|
return
|
|
File without changes
|
|
File without changes
|