def inputiter(): if os.isatty(stdin.fileno()): while 1: try: yield _helpers.readline(b'bup> ') except EOFError: print() # Clear the line for the terminal's next prompt break else: for line in stdin: yield line
def inputiter(): if os.isatty(stdin.fileno()): while 1: if hasattr(_helpers, 'readline'): try: yield _helpers.readline(b'bup> ') except EOFError: print() # Clear the line for the terminal's next prompt break else: out.write(b'bup> ') out.flush() read_line = stdin.readline() if not read_line: print('') break yield read_line else: for line in stdin: yield line
def inputiter(f): if os.isatty(f.fileno()): while 1: prompt = b'bup %s> ' % (b'/'.join(name for name, item in pwd) or b'/', ) if hasattr(_helpers, 'readline'): try: yield _helpers.readline(prompt) except EOFError: print() # Clear the line for the terminal's next prompt break else: out.write(prompt) out.flush() read_line = f.readline() if not read_line: print('') break yield read_line else: for line in f: yield line