-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input frequently alternates between pager and prompt #508
Comments
Doing some testing with |
I'm wondering if this is actually a weird OS-level bug, but I'm not sure how to confirm that really. What I believe is happening is that both |
I was able to put together a small proof-of-concept that has basically the same behavior as what I'm seeing in package main
import (
"os"
"os/exec"
"github.com/xo/usql/rline"
)
func panicIf(err error) {
if err != nil {
panic(err)
}
}
func main() {
f, err := os.Open("../usql/main.go")
panicIf(err)
cmd := exec.Command("less")
cmd.Stdin = f
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Start()
panicIf(err)
io, err := rline.New(true, false, false, "", "")
panicIf(err)
io.Next()
err = cmd.Wait()
panicIf(err)
} Anything can be used as input to This seems to confirm what I'm seeing is that both |
In some scenarios, it seems like input intended for the pager is instead read by the
usql
prompt.When I first start up
usql
and query enough data to activate the pager, I can scroll through the results and exit the pager by simply pressingq
. This is the expected behavior.However, when I then run a different query that also uses the pager, pressing
q
instead shows theusql
prompt, with theq
press read:Pressing
q
a second time then successfully quits the pager, but there is still the lingering input at the prompt.This isn't specific to
q
, though it's the most common scenario for me. If I run the query again, pressingj
repeatedly will alternate between scrolling the pager down one row, and adding anotherj
at the prompt. Input seems to jump back and forth between the two, until I successfully get the pager to read aq
.My
PAGER
environment variable is not set, sousql
is using whatever the default pager is (presumablyless
).Tested with
usql
0.19.14 on Ubuntu 22.04.The text was updated successfully, but these errors were encountered: