Browse Source

[264] Do not prompt for user name and password if not interactive.

If you attempt to pipe commands in to bindctl and the session is not
interactive (i.e it is not a TTY) then do not attempt to read the user
name and password.
Kean Johnston 11 years ago
parent
commit
4921d7de6b
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/bin/bindctl/bindcmd.py

+ 5 - 0
src/bin/bindctl/bindcmd.py

@@ -272,6 +272,11 @@ WARNING: The Python readline module isn't available, so some command line
         else:
             self._print('Login failed: either the user name or password is '
                         'invalid.\n')
+
+        # If this was not an interactive session do not prompt for login info.
+        if not sys.stdin.isatty():
+            return False
+
         while True:
             count = count + 1
             if count > 3: