lnav icon indicating copy to clipboard operation
lnav copied to clipboard

toggle text file view may terminate lnav directly

Open kcwu opened this issue 11 months ago • 2 comments

lnav version master (0.12.4-177-gc8e7248)

Describe the bug When view text files, lnav terminated directly when I hit hotkey "t". Lnav terminated with log "text view popped and no other files, exiting..."

To Reproduce Steps to reproduce the behavior:

  1. echo a > /tmp/a
  2. lnav /tmp/a
  3. keyin "t"; then lnav terminated immediately without any messages

Why it is not good to terminate lnav this way:

  1. For users like me, running "program | lnav" and unfortunately the output is not log format. lnav termination means the output is lost.
  2. it terminated without any UI messages and confused users. If termination is the desired behavior, it is better to show messages and/or confirm with user.

kcwu avatar Mar 19 '25 09:03 kcwu

running "program | lnav" and unfortunately the output is not log format. lnav termination means the output is lost.

Hmm, the output shouldn't be lost, though. lnav stores the input in a file in order to support scrollback. On exit, lnav should print a message explaining as much and the command to run to reopen the file:

% echo hello | lnav
ⓘ info: 1.8KB of data from stdin was captured and will be saved for one day.  You can reopen it by running:
   lnav piper://p-5bc17675aaa0a87813cd78a284e539f3-000

tstack avatar Mar 20 '25 04:03 tstack

Thanks. The other issue is, the program may terminate due to broken pipe and I need to rerun it.

kcwu avatar Mar 20 '25 04:03 kcwu

I've changed the behavior to not pop the TEXT view when pressing "t" and there are only text files loaded.

Thanks.

tstack avatar Sep 04 '25 22:09 tstack