walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
674 stars 19 forks source link

ct moar | wc hangs #176

Closed ciscohack closed 10 months ago

ciscohack commented 10 months ago

mo = "ct moar" and then if run mo and pipe anything to this example mo | wc ..it freeze the cli or tab and ctrl + c/z/d nothing works ..... Request you please address this scenario also and in any freeze case ctrl + c/z should work

walles commented 10 months ago

It seems that ct tells moar that stdout is a terminal even when it isn't (ct moar xxx | wc).

This would be an issue with ct, and I suggest you open a ticket with the ct developers.

Longer Explanation

When moar starts it early on decides whether it's printing to a terminal or a stream.

It does this by doing isatty() ("is this a terminal?") on stdout.

If isatty() says "terminal" then moar shows its UI.

Enter ct. ct seems to be telling moar that stdout is a terminal, even in the ct moar | wc case.

Workaround(ish)

Press q. Since moar believes it's printing to a terminal, it will respond to keypresses.

Note that the word counts will be for moar's UI in this case, and not for the input file which is what you might expect. Try with cat to see what I mean.