diff options
Diffstat (limited to 'packages/meshbay-cli/src/meshbay_cli/commands/context.py')
| -rw-r--r-- | packages/meshbay-cli/src/meshbay_cli/commands/context.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/meshbay-cli/src/meshbay_cli/commands/context.py b/packages/meshbay-cli/src/meshbay_cli/commands/context.py index 827c101..0f7e842 100644 --- a/packages/meshbay-cli/src/meshbay_cli/commands/context.py +++ b/packages/meshbay-cli/src/meshbay_cli/commands/context.py @@ -12,7 +12,7 @@ from ..client.hub import DEFAULT_HUB, Hub from ..client.paths import handle from ..client.store import Store from ..errors import USAGE, CliError -from ..output import safe +from ..output import safe, terminal class Context: @@ -45,7 +45,7 @@ class Context: if value is None: value = os.environ.get("MESHBAY_PASSWORD") if value is None: - if not sys.stdin.isatty(): + if not terminal(sys.stdin): raise NoPassphrase("A passphrase is needed and there is no terminal to ask " "on; pass --password-file or set MESHBAY_PASSWORD.") value = getpass.getpass(f"Passphrase for {self.username or self.stored_username}" @@ -62,7 +62,7 @@ class Context: def _device_code(self, group: dict, pending, *, first: bool) -> bool: """Show the code once. Wait only where somebody is there to approve it.""" - waiting = sys.stderr.isatty() and not self.args.quiet + waiting = terminal(sys.stderr) and not self.args.quiet if first: minutes = max(1, int((pending.expires_at - time.time()) // 60)) print(f"This machine is not yet a device of yours on the node hosting " |