Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid hidden interactive ssh prompts at low verbosity levels. #9638

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from poetry.puzzle.exceptions import OverrideNeeded
from poetry.repositories.exceptions import PackageNotFound
from poetry.utils.helpers import get_file_hash
from poetry.utils import pause_indicator


if TYPE_CHECKING:
Expand Down Expand Up @@ -105,6 +106,11 @@ def _formatter_elapsed(self) -> str:

return f"{elapsed:.1f}s"

def _display(self, *args, **kwargs):
if pause_indicator.is_paused():
return
super()._display(*args, **kwargs)


class Provider:
UNSAFE_PACKAGES: ClassVar[set[str]] = set()
Expand Down
20 changes: 20 additions & 0 deletions src/poetry/utils/pause_indicator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

from threading import Lock

_lock = Lock()
_counter = 0

def is_paused():
return _counter != 0

class IndicatorPaused:
def __enter__(self):
global _counter
with _lock:
_counter += 1

def __exit__(self, *exc):
global _counter
with _lock:
_counter -= 1
assert _counter >= 0
12 changes: 7 additions & 5 deletions src/poetry/vcs/git/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from poetry.console.exceptions import PoetryConsoleError
from poetry.utils.authenticator import get_default_authenticator
from poetry.utils.helpers import remove_directory
from poetry.utils.pause_indicator import IndicatorPaused


if TYPE_CHECKING:
Expand Down Expand Up @@ -207,11 +208,12 @@ def _fetch_remote_refs(cls, url: str, local: Repo) -> FetchPackResult:
client, path = get_transport_and_path(url, config=config, **kwargs)

with local:
result: FetchPackResult = client.fetch(
path,
local,
determine_wants=local.object_store.determine_wants_all,
)
with IndicatorPaused():
result: FetchPackResult = client.fetch(
path,
local,
determine_wants=local.object_store.determine_wants_all,
)
return result

@staticmethod
Expand Down
Loading