pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

stderr swallowed when using visidata as pager

Open kbd opened this issue 3 years ago • 6 comments

Description

When using visidata as pager, stderr is swallowed.

There are a few tickets about similar issues (#1200, #1275) but after reading those tickets I don't know that there is a solution that works.

Interestingly, litecli works properly! Here are my configs and some examples:

pgcli config:

[main]
pager = kw /usr/local/bin/vd -f csv
table_format = csv
less_chatty = True
prompt = '> '

litecli config:

[main]
multi_line = False
pager = kw /usr/local/bin/vd
table_format = tsv
less_chatty = True

kw is "kitty window" that opens the output in a split, as you can see in the screenshots:

Visidata works as pager:

Screen Shot 2022-03-21 at 4 17 18 PM

But stderr swallowed:

Screen Shot 2022-03-21 at 4 17 28 PM

Visidata works as pager in litecli:

Screen Shot 2022-03-21 at 4 51 13 PM

But stderr is not swallowed:

Screen Shot 2022-03-21 at 4 51 55 PM

For some reason using Visidata only works as a pager in pgcli with csv format and not tsv (like I have set with litecli). If set to tsv, the pager seems to be ignored.

Running on Mac Big Sur 11.6.4 and pgcli version Version: 3.4.1.

kbd avatar Mar 22 '22 15:03 kbd

@lelit I think you ran into a similar issue earlier. Were you able to fix the issue?

amjith avatar May 23 '22 00:05 amjith

I'm able to reproduce the issue. I'll take a deeper look into why this is happening. Sorry about the issue.

amjith avatar May 23 '22 02:05 amjith

Here's the pending PR: https://github.com/dbcli/pgcli/pull/1341

You can install this locally with this command:

pip install -U https://github.com/dbcli/pgcli/archive/refs/heads/fix-csv-status.zip

Can you give that a try?

@lelit I believe you worked on ensuring the csv format works well with pspg pager. Can I ask your help to verify that this won't break the integration with pspg?

amjith avatar May 23 '22 03:05 amjith

Yes, I will try that out and report back

lelit avatar May 23 '22 06:05 lelit

@amjith I just installed the pending PR and stderr is visible now.

edit: I think it would be nice if stderr wasn't read by Visidata though, and instead just printed out in the command line. This just doesn't look great and having to press extra keys to read the error message is annoying. image

waydegilliam avatar Jun 21 '22 23:06 waydegilliam

I think it would be nice if stderr wasn't read by Visidata though, and instead just printed out in the command line.

Given that litecli works the right way -- it prints the error inline (see original screenshot) -- why can't pgcli?

kbd avatar Sep 15 '22 18:09 kbd