Commits

Robert Leftwich committed 4c47392

Change osx keychain backend to use popen.communicate instead of wait to eliminate blocking on larger passwords.

Comments (0)

Files changed (2)

keyring/backend.py

             self.win32cred = None
 
     def supported(self):
-        '''Default Windows backend, when it is available
-        '''
+        """Default Windows backend, when it is available
+        """
         recommended = select_windows_backend()
         if recommended == None:
             return -1

keyring/backends/osx_keychain.py

             stderr = subprocess.PIPE,
             stdout = subprocess.PIPE,
         )
-        code = call.wait()
+        stdoutdata, stderrdata = call.communicate()
+        code = call.returncode
         # check return code.
         if code is not 0:
             raise OSError('Can\'t store password in keychain')
             stderr = subprocess.PIPE,
             stdout = subprocess.PIPE,
         )
-        code = call.wait()
+        stdoutdata, stderrdata = call.communicate()
+        code = call.returncode
         if code is not 0:
             raise OSError("Can't fetch password from system")
-        output = call.stderr.readlines()[0]
+        output = stderrdata
         # check for empty password.
         if output == 'password: \n':
             return ''