]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/ftp-cmd.py
ftp: handle lack of readline in input
[bup.git] / lib / cmd / ftp-cmd.py
index 8e05fa831d232d3021dd8a4143e8f52567c8cccf..02a6fecef014609806e827c0c3a0b7aa222a6c1e 100755 (executable)
@@ -55,11 +55,20 @@ def write_to_file(inf, outf):
 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
+            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