new method ConsoleApplication.acquire_input() to read stdin friendly

This commit is contained in:
Romain Bignon 2011-07-11 22:18:04 +02:00
commit e731f42cb9
4 changed files with 12 additions and 9 deletions

View file

@ -77,7 +77,7 @@ class Pastoob(ReplApplication):
The filename can be '-' for reading standard input (pipe).
"""
if not filename or filename == '-':
contents = sys.stdin.read().decode(sys.stdin.encoding or locale.getpreferredencoding())
contents = self.acquire_input()
else:
try:
with codecs.open(filename, encoding=locale.getpreferredencoding()) as fp: