2,262 questions
3
votes
3
answers
232
views
Performance issues with reading lines from *standard-input*
I need to process 100 Gigabytes of logs in a weird format, then do some analysis on the results.
Initial parts of parsing and CLI done, tried on some test data with 1 GB and it took around a minute. I ...
1
vote
1
answer
133
views
php's readline() method adding weird line breaks when executed via shell?
So I have this really weird issue where I have the following dummy.php script:
<?php
declare(strict_types=1);
$prompt = "Hello there!".
PHP_EOL . "What do you want to know?"...
0
votes
1
answer
75
views
How to stop emitting keypress events after calling `readline.emitKeypressEvents` in Node.js [duplicate]
I want to asynchronously process keyboard events in a Node.js application. It was recommended to me to use readline.emitKeypressEvents which leads to code like this:
import readline from "node:...
0
votes
3
answers
95
views
Using Vim macros on the command line
I am using Vim bindings in bash (set -o vi) and I wanted to know if it is possible to use and save Vim macros on the command line. For instance, I would like to save a macro like this:
let @q = "...
0
votes
3
answers
132
views
Is this the correct way to move to the beginning of each line in a text file using seek()?
from sys import argv
script, input_file = argv
hello = open(input_file)
read1 = hello.readline()
print("Line1: ", read1, end = "")
line1 = len(read1) + 1
print(line1)
read2 = ...
1
vote
0
answers
118
views
gdb backspace deletes whole line?
I just hate it so much when small things that were working since forever suddenly break.
I use MINGW64 bash in Windows Terminal in Windows 10. When I run gdb-multiarch, inside it, suddenly Backspace ...
2
votes
1
answer
101
views
Can't get GNU readline with bash to use STDOUT/FD1 as rl_outstream
I am writing a Go wrapper that does various things and then executes an interactive bash shell. I would like to usurp FD2 of this child process with my own thing that is fed in from the Go wrapper. ...
1
vote
0
answers
27
views
Why puppeteer blocks callbacks from execution?
This code as it is opens the browser and read a txt file line by line:
line 1
line 2
line 3
Stream closed
The thing I don't understand is why placing const browser = await puppeteer....
0
votes
1
answer
75
views
clang: error: no such file or directory: '–lreadline'
I am migrating a working application on a Raspberry Pi to the latest OS Bookworm.
On make, I get the following error:
make
clang++ -lpthread -L/usr/local/lib –lreadline -lcurl -lpigpio -o build/...
2
votes
0
answers
68
views
process.stdin is not recognized as ReadableStream when using readline.createInterface
I've got a strange issue with TypeScript when trying to use the readline to create an interface reading the console window. From what I can tell, process.stdin returns a ReadStream whilst ...
0
votes
1
answer
74
views
Scanner.readLine() with custom line delimeter
I have a string that needs to be read using the Scanner class from the beginning to the \n character. The problem is that the source stream in my case may contain the character \u2028. I know that the ...
2
votes
2
answers
97
views
How can I properly reprint a readline prompt on SIGINT?
I have the following signal handler established:
void sig_handler(int sig)
{
if (sig == SIGINT)
{
printf("\n");
rl_on_new_line();
rl_replace_line("&...
1
vote
0
answers
97
views
Is there a way in python's readline module to bind a key to a custom function?
I'm using the python readline module (and using the input() function, which readline modifies). Everything is working, but I would like to add a feature to call a custom python function when a ...
0
votes
0
answers
45
views
Why isn't my R script pausing when I ask for a prompt?
I'm writing a script that asks for multiple user inputs using the command:
readline(prompt = "Question here")
My first attempt at the beginning of the script works correctly. I'm asking for ...
1
vote
1
answer
65
views
How do I catch return characters when using character-at-a-time BASH builtin read with if or a case statement?
I stumbled across what should be something simple that's turned out to be a brain-teaser. As a not fully accomplished BASH programmer, I naively thought I could read in characters from an interactive ...
6
votes
2
answers
2k
views
Read a single line user input with in Bun.js
Bun.js has a nice native API to read periodical user input:
const prompt = "Type something: ";
process.stdout.write(prompt);
for await (const line of console) {
console.log(`You typed: ${...
0
votes
2
answers
70
views
Having an asynchronous issue with my JavaScript code when using a timeout with Node.js
So the purpose of the code is to import JSON questions and read them to the user in the terminal. The user gets 5 seconds to answer the question until the next question is displayed. The issue I am ...
0
votes
1
answer
119
views
Edit the final part of large(1.5gb) text file in NodeJS
My tool appends little json blocks with comma at their end into a txt file which initially has [ as the first character, in order to create a whole JSON format text file, like below,
{data: text1},
...
0
votes
1
answer
66
views
Why do my Java server tests pass when I add a System.out.println(in.readLine()) statement before the tests, but fail without that statement?
I'm working on implementing a server in Java to handle a multiplayer Minesweeper game. In trying to test my server to ensure that it responds correctly to legal client requests, I am finding that the ...
1
vote
0
answers
113
views
Accessing Readline's "application name" in Ruby
Is there any way (supported or otherwise) to set Readline's rl_readline_name variable from Ruby's Readline module? Or even to read it to find out the current value?
It seems to be only marginally ...
1
vote
0
answers
60
views
Make readline tab cycle options within a C application
When using bash, if you run bind 'TAB:menu-complete' readline will cycle through all the possible matches. However I can't find a way to do the same in a C program that uses readline for input.
The ...
0
votes
0
answers
151
views
Use ansi escape sequences to create a border between input and output
I am writing an app with streaming text output that needs to have an input area fixed to the bottom of the screen.
I am using node:readline and ansi-escapes and I just cannot figure out how to ...
1
vote
1
answer
39
views
readline: activating copies of both emacs-standard and emacs-meta keymaps
My aim is to:
Copy emacs-standard and emacs-meta keymaps,
Activate the copies
Make changes to the copies
Restore the emacs-standard and emacs-meta keymaps
I have read that emacs-meta is assigned to ...
0
votes
0
answers
141
views
Extra Prompt Displayed in GNU Readline
I'm writing a shell-like program in C using GNU readline and have encountered a bug related to prompt handling.
Brief Description of the Issue
In my program, after exiting a heredoc with ^D and then ...
0
votes
1
answer
45
views
C-W is deleting my command prompt - how to stop this
I'm working on a small shell and using libreadline to get command input.
problem
My command prompt is getting deleted when I use C-W
note this only happens after I enter a word and then C-W, C-w ...