pastoob: Abort if paste is empty

This commit is contained in:
Laurent Bachelier 2012-10-21 17:48:56 +02:00
commit 770c0877a0

View file

@ -78,6 +78,10 @@ class Pastoob(ReplApplication):
"""
if not filename or filename == '-':
contents = self.acquire_input()
if not len(contents):
print >>sys.stderr, 'Empty paste, aborting.'
return 1
else:
try:
with codecs.open(filename, encoding=locale.getpreferredencoding()) as fp: