瀏覽代碼

Fix typo preventing the security confirmation prompt from working

Closes #303
Jonas Borgström 10 年之前
父節點
當前提交
a24d0f4cba
共有 3 個文件被更改,包括 6 次插入4 次删除
  1. 1 0
      CHANGES
  2. 1 1
      attic/cache.py
  3. 4 3
      attic/testsuite/archiver.py

+ 1 - 0
CHANGES

@@ -7,6 +7,7 @@ Version 0.16
 ------------
 
 (bugfix release, released on X)
+- Fix typo preventing the security confirmation prompt from working (#303)
 - Improve handling of systems with improperly configured file system encoding (#289)
 - Fix "All archives" output for attic info. (#183)
 - More user friendly error message when repository key file is not found (#236)

+ 1 - 1
attic/cache.py

@@ -68,7 +68,7 @@ class Cache(object):
         if env_var_override and os.environ.get(env_var_override):
             print("Yes (From {})".format(env_var_override))
             return True
-        if sys.stdin.isatty():
+        if not sys.stdin.isatty():
             return False
         try:
             answer = input('Do you want to continue? [yN] ')

+ 4 - 3
attic/testsuite/archiver.py

@@ -106,18 +106,19 @@ class ArchiverTestCaseBase(AtticTestCase):
             self.assert_equal(exit_code, ret)
             return output
         args = list(args)
-        stdout, stderr = sys.stdout, sys.stderr
+        stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr
         try:
+            sys.stdin = StringIO()
             output = StringIO()
             sys.stdout = sys.stderr = output
             ret = self.archiver.run(args)
-            sys.stdout, sys.stderr = stdout, stderr
+            sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr
             if ret != exit_code:
                 print(output.getvalue())
             self.assert_equal(exit_code, ret)
             return output.getvalue()
         finally:
-            sys.stdout, sys.stderr = stdout, stderr
+            sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr
 
     def create_src_archive(self, name):
         self.attic('create', self.repository_location + '::' + name, src_dir)