mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-28 23:04:33 +02:00
lib.util.run_cmd(): Rewrite it to be async
run_cmd() is synchronous. Now that all commands are asynchronous, we
can await it, so rewrite it to be asynchronous, too.
Other changes:
- Make it return stderr as well in case its needed
- Drop into a pseuto-tty if
- cmd_input == "mode:interactive" or
- cmd_input == "mode:auto" and stdin is a TTY
- Add argument env, defaulting to None. If it's a dict, it will be
the environment the command is run in
This entails making all functions using run_cmd() async, too,
including run_curl(), get_username() and get_password().
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
9c06103a4a
commit
4274a71c62
4 changed files with 162 additions and 44 deletions
|
|
@ -29,7 +29,7 @@ class CmdGetAuthInfo(Cmd): # export
|
|||
if not os.path.isdir(jw_pkg_dir + '/.git'):
|
||||
log(DEBUG, f'jw-pkg directory is not a Git repo: {jw_pkg_dir}')
|
||||
return
|
||||
remotes = run_cmd(['git', '-C', jw_pkg_dir, 'remote', '-v'])
|
||||
remotes, stderr = await run_cmd(['git', '-C', jw_pkg_dir, 'remote', '-v'])
|
||||
result: dict[str, str] = {}
|
||||
for line in remotes.split('\n'):
|
||||
if re.match(r'^\s*$', line):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue