Questions tagged [readline]

A library for command line editing, or a function to read one line of text.

Readline may refer either the GNU readline library, used for editing a command line; or a function or method in various programming languages which typically reads a line of text from an open file handle.

GNU readline library

The gnu readline library provides applications with an interactive command prompt with features like

  • flexible command editing
  • configurable key bindings to mimic e.g. or
  • a history of past commands

Probably the most prominent application using readline is . Both packages are maintained by the same person. Many programming languages provide bindings for this library.

readline function

Examples of readline functions or methods include

(please extend this list if you know more languages using this name)

2233 questions
8
votes
1 answer

Duplicate output on Python tab completion (OsX 10.8)

Using the snippet below, I have added tab completion to the python interpreter. import readline import rlcompleter if 'libedit' in readline.__doc__: readline.parse_and_bind("bind ^I rl_complete") else: readline.parse_and_bind("tab:…
Eren Güven
  • 2,314
  • 19
  • 27
8
votes
2 answers

BufferedReader.readLine() waits for input from console

I am trying to read lines of text from the console. The number of lines is not known in advance. The BufferedReader.readLine() method reads a line but after the last line it waits for input from the console. What should be done in order to avoid…
ambar
  • 2,053
  • 6
  • 27
  • 32
8
votes
2 answers

Reference stdout (i.e. output of previous command) quickly in bash?

Is there a way to quickly (e.g. via a keyboard shortcut, etc.) to reference the output of the previous command's output that it wrote to stdout? For example, if I did this: which rails and it returned /usr/local/bin/rails and then I wanted to open…
user1516425
  • 1,531
  • 2
  • 15
  • 21
8
votes
1 answer

BufferedReader vs. RandomAccessFile in java

I'm writing a small application in java I read text files in various sizes and I need to read them line by line (and insert the line into array). Is there difference between BufferedReader.ReadLine() and RandomAccessFile.ReadLine(), in terms of…
choppy
  • 739
  • 1
  • 12
  • 22
8
votes
1 answer

How to read from a child_process line by line in Node.js?

I am trying to make a Node.js script to analyse disk usage. For this, I shell out to du, but I am having trouble figuring out how to read the output from the child process line by line. Here's what I've tried so far: var spawn =…
mikl
  • 23,749
  • 20
  • 68
  • 89
7
votes
5 answers

C# read line from file with StreamReader with DownloadFileAsync

I am having a problem reading file with StreamReader and while line != null add to textBox1 Code: using(StreamReader reader = new StreamReader("lastupdate.txt")) { string line; while((line = reader.ReadLine()) != null) { …
user1085907
  • 1,009
  • 2
  • 16
  • 40
7
votes
1 answer

Why does gnu readline require me to hit control c twice?

Normally, Control-C sends a sigint to a program, and kills it if it's not caught. The gnureadline library will install handlers for sigint. However, even when disabling those handlers in haskell, I still need to hit Control-C twice to kill a…
archgoon
  • 1,538
  • 2
  • 14
  • 19
7
votes
3 answers

How do you install the haskell readline library on Mac OSX?

I'm referring to the haskell readline library wrapper to the c readline library. cabal install readline output below: $ cabal install readline Resolving dependencies... Configuring readline-1.0.1.0... checking for gcc... gcc checking for C compiler…
David Miani
  • 14,518
  • 2
  • 47
  • 66
7
votes
2 answers

Python: Read huge number of lines from stdin

I'm trying to read a huge amount of lines from standard input with python. more hugefile.txt | python readstdin.py The problem is that the program freezes as soon as i've read just a single line. print sys.stdin.read(8) exit(1) This prints the…
Martin
  • 5,197
  • 11
  • 45
  • 60
7
votes
3 answers

How do I link against the GNU readline library rather than libedit in macosx?

Attempting to build Term-Readline-Gnu on macosx, fails complaining about libedit and recommending to use gnu readline. How do I do that? This is one of the attempts I have tried: First I built GNU libreadline v6.2 statically but did not install it -…
Chris
  • 71
  • 1
  • 3
7
votes
1 answer

Showing function arguments in order in an R shell

When I open R from the terminal, I can use the Tab key to autocomplete functions and objects. By pressing the Tab key after a function and (, the function arguments get listed. However, it looks like that in Ubuntu those arguments are ordered…
nicola
  • 24,005
  • 3
  • 35
  • 56
7
votes
3 answers

Why does this readline async iterator not work properly?

This is part of a larger process that I've distilled down to the minimal, reproducible example in node v14.4.0. In this code, it outputs nothing from inside the for loop. I see only this output in the console: before for()…
jfriend00
  • 683,504
  • 96
  • 985
  • 979
7
votes
2 answers

Difference in read(), readline() and readlines() in Python

I was looking on a web of Python the commands mentioned in title and their difference; however, I have not satisfied with a complete basic understanding of these commands. Suppose my file has only the following content. This is the first time I am…
Soluble
  • 171
  • 1
  • 1
  • 4
7
votes
1 answer

GNU readline: enormous memory leak

Consider the following snippet: #include #include #include int main() { for (;;) { char *buf = readline(">>> "); if (!buf) break; free(buf); } } Compiling with…
Peter
  • 2,919
  • 1
  • 16
  • 35
7
votes
1 answer

With Node.JS Readline: "TypeError: rl is not async iterable"

When I run the very code listed in the readline example async function processLineByLine() { const fileStream = fs.createReadStream('input.txt'); const rl = readline.createInterface({ input: fileStream, crlfDelay: Infinity }); //…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468