[meld] Workaround `svk info` bugs (it is used to determine if a directory is a svk working copy)



commit d7fbf35fe5ee0b7d309b643d143f1b70b396506a
Author: Vincent Legoll <vincent legoll gmail com>
Date:   Sun Apr 26 00:07:00 2009 +0200

    Workaround `svk info` bugs (it is used to determine if a directory is a svk working copy)
    - fix meld hang due to svk waiting for user interaction.
      It asks if a repository is to be created
    - restore stdin sanity after having run svk info
---
 vc/svk.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/vc/svk.py b/vc/svk.py
index cfdbe41..a62b057 100644
--- a/vc/svk.py
+++ b/vc/svk.py
@@ -32,7 +32,13 @@ class Vc(svn.Vc):
 
     def is_repo_root(self, location):
         try:
-            status = misc.cmdout([self.CMD, "info"], cwd=location, stdout=misc.NULL)[1]
+            # `svk info` may be interactive. It can ask to create its repository, we
+            # don't want that to happen, so provide the right answer with `text="n"`
+            status = misc.cmdout([self.CMD, "info"], cwd=location, stdout=misc.NULL,
+                                 stderr=misc.NULL, text='n')[1]
+            # SVK does evil things to the real stdin, even when having its input
+            # stream redirected to a newly created pipe, restore sanity manually
+            misc.cmdout(['stty', 'sane'], stdout=misc.NULL, stderr=misc.NULL, stdin=None)
         except OSError:
             raise ValueError()
         if status != 0:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]