Skip to content

Commit

Permalink
turn off user input completely in async mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nosarthur committed Apr 9, 2019
1 parent 89d5215 commit 1e03951
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
7 changes: 0 additions & 7 deletions gita/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,8 @@ def f_git_cmd(args: argparse.Namespace):
# Async execution cannot deal with multiple repos' user name/password.
# Here we shut off any user input in the async execution, and re-run
# the failed ones synchronously.
cache = os.environ.get('GIT_ASKPASS')
os.environ['GIT_ASKPASS'] = 'echo'
errors = utils.exec_async_tasks(
utils.run_async(path, cmds) for path in repos.values())
# Reset context and re-run
if cache:
os.environ['GIT_ASKPASS'] = cache
else:
del os.environ['GIT_ASKPASS']
for path in errors:
if path:
print(path)
Expand Down
1 change: 1 addition & 0 deletions gita/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ async def run_async(path: str, cmds: List[str]) -> Union[None, str]:
"""
process = await asyncio.create_subprocess_exec(
*cmds,
stdin=subprocess.DEVNULL,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
start_new_session=True,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
setup(
name='gita',
packages=['gita'],
version='0.9.0',
version='0.9.1',
license='MIT',
description='Manage multiple git repos',
long_description=long_description,
Expand Down

0 comments on commit 1e03951

Please sign in to comment.