Rev 4831: Shelve command refuse to run if there is no real terminal in http://bazaar.launchpad.net/~vila/bzr/integration

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Nov 26 17:24:12 GMT 2009


At http://bazaar.launchpad.net/~vila/bzr/integration

------------------------------------------------------------
revno: 4831 [merge]
revision-id: v.ladeuil+lp at free.fr-20091126172354-trehdpr5azzq97j5
parent: pqm at pqm.ubuntu.com-20091126054210-6mbpjr1bstyu92wv
parent: v.ladeuil+lp at free.fr-20091126170632-zcgrykp0dt0yig52
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: integration
timestamp: Thu 2009-11-26 18:23:54 +0100
message:
  Shelve command refuse to run if there is no real terminal
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/shelf_ui.py             shelver.py-20081005210102-33worgzwrtdw0yrm-1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-11-26 04:09:19 +0000
+++ b/NEWS	2009-11-26 17:23:54 +0000
@@ -171,6 +171,9 @@
   the sha1 from the repo directly. (John Arbash Meinel)
 
 
+* Shelve command refuse to run if there is no real terminal.
+  (Alexander Belchenko)
+
 Documentation
 *************
 

=== modified file 'bzrlib/shelf_ui.py'
--- a/bzrlib/shelf_ui.py	2009-11-02 21:56:42 +0000
+++ b/bzrlib/shelf_ui.py	2009-11-26 17:06:32 +0000
@@ -253,6 +253,12 @@
         :param message: The message to prompt a user with.
         :return: A character.
         """
+        if not sys.stdin.isatty():
+            # Since there is no controlling terminal we will hang when trying
+            # to prompt the user, better abort now.  See
+            # https://code.launchpad.net/~bialix/bzr/shelve-no-tty/+merge/14905
+            # for more context.
+            raise errors.BzrError("You need a controlling terminal.")
         sys.stdout.write(message)
         char = osutils.getchar()
         sys.stdout.write("\r" + ' ' * len(message) + '\r')



More information about the bazaar-commits mailing list