mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-28 16:45:24 +02:00
lib.ExecContext: Support bytes-typed cmd_input
The Input instance passed as cmd_input to ExecContext.run() and .sudo() currently may be of type str. Allow to pass bytes, too. At the same time, disallow None to be passed as cmd_input. Force the caller to be more explicit how it wants input to be handled, notably with respect to interactivity. Along the way fix a bug: Content in cmd_input should result in CallContext.interactive == False but doesn't. Fix that. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8ef478e63f
commit
04b294917f
9 changed files with 46 additions and 29 deletions
|
|
@ -120,7 +120,6 @@ class CmdBuild(Cmd): # export
|
|||
wd=wd,
|
||||
throw=True,
|
||||
verbose=True,
|
||||
cmd_input=None,
|
||||
env=env,
|
||||
title=title
|
||||
)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ class CmdListRepos(Cmd): # export
|
|||
print('\n'.join(result.stdout.decode().splitlines()))
|
||||
return
|
||||
case 'https':
|
||||
cmd_input = None
|
||||
from jw.pkg.lib.ExecContext import InputMode
|
||||
cmd_input = InputMode.NonInteractive
|
||||
if re.match(r'https://github.com', args.base_url):
|
||||
curl_args = [
|
||||
'-f',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue