Skip to content
Browse files

check if the stdout is a tty before prompting a user

Fix garbled output when the user redirects the tx output
into a pipe.
  • Loading branch information...
1 parent 0f5ba34 commit 8d1de63b9925ff00ada0efd5598d2ab1a17eab5d Vrachnis Ilias-Dimitrios committed May 21, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 txclib/project.py
View
3 txclib/project.py
@@ -93,7 +93,8 @@ def _migrate_txrc_file(self, txrc):
if hostname != orig_hostname:
msg = "Hostname %s should be changed to %s."
logger.info(msg % (orig_hostname, hostname))
- if sys.stdin.isatty() and confirm('Change it now? ', default=True):
+ if (sys.stdin.isatty() and sys.stdout.isatty() and
+ confirm('Change it now? ', default=True)):
txrc.set(section, 'hostname', hostname)
msg = 'Hostname changed'
logger.info(msg)

0 comments on commit 8d1de63

Please sign in to comment.
Something went wrong with that request. Please try again.