diff --git a/src/omero/plugins/sessions.py b/src/omero/plugins/sessions.py index 75ac0d0b8..aaa408600 100644 --- a/src/omero/plugins/sessions.py +++ b/src/omero/plugins/sessions.py @@ -448,6 +448,9 @@ def login(self, args): action = "Reconnected to" if not rv: + + self._require_tty("cannot request password") + tries = 3 while True: try: @@ -883,6 +886,7 @@ def _get_server(self, store, name, port): defserver = store.last_host() if not port: port = str(omero.constants.GLACIER2PORT) + self._require_tty("cannot request server") rv = self.ctx.input("Server: [%s:%s]" % (defserver, port)) if not rv: return defserver, name, port @@ -892,12 +896,18 @@ def _get_server(self, store, name, port): def _get_username(self, defuser): if defuser is None: defuser = get_user("root") + self._require_tty("cannot request username") rv = self.ctx.input("Username: [%s]" % defuser) if not rv: return defuser else: return rv + def _require_tty(self, msg): + if sys.stdin.isatty(): + return + self.ctx.die(564, "stdin is not a terminal: %s" % msg) + try: register("sessions", SessionsControl, HELP)