diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-03-18 17:43:16 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-03-18 17:44:45 +0100 |
commit | ddaa65357f436eb63110c8d4ec971989e3e79fdd (patch) | |
tree | 222ed1f287f4b39d7bca57f944aa562afe51e31a /gbp | |
parent | 8fd616208e564417723d2f990af295ae62c30ce6 (diff) |
gbp-create-remote-repo: don't expect a terminal
so you can do 'echo y | gbp-create-remote-repo'
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/scripts/create_remote_repo.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py index 7f2967bd..6ecf12e0 100644 --- a/gbp/scripts/create_remote_repo.py +++ b/gbp/scripts/create_remote_repo.py @@ -117,12 +117,18 @@ def parse_remote(remote_url, name, pkg): def read_yn(): fd = sys.stdin.fileno() - old_settings = termios.tcgetattr(fd) try: - tty.setraw(sys.stdin.fileno()) + old_settings = termios.tcgetattr(fd) + except termios.error: + old_settings = None + + try: + if old_settings: + tty.setraw(sys.stdin.fileno()) ch = sys.stdin.read(1) finally: - termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) + if old_settings: + termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) if ch in ( 'y', 'Y' ): return True |