Skip to content

Terminating ceylon help with less pager leaves terminal in dirty state #53

@lucaswerkmeister

Description

@lucaswerkmeister

On Linux, with default pager settings, run ceylon help, then terminate the process with Ctrl+C. This will leave the terminal in a weird state where:

  • less is terminated, but its output still visible
  • your prompt is printed (right after the less prompt ‘:’)
  • the next character will be swallowed (for some meaning of “character” – Esc and Enter have the same effect, while Ctrl+C will re-print the prompt)
  • upon entering that character, the terminal will reset to show the regular output before less was started
  • the terminal is “silent”, characters typed are not echoed – blind-type reset and hit Enter to fix this

I have no idea what’s going on here; I tried to investigate it, but didn’t arrive at any conclusions. Notes:

  • less is supposed to stay open when its input is closed, and ignore Ctrl+C itself. This is useful, for instance, when running git log -Ssearch (or another expensive Git operation) – you’ll terminate git after the first few results are there, then look through those results with less still up.

    • in the above scenario, git actually continues running after terminated – not sure what’s happening here.
  • piping ceylon help into less manually works without problems.

  • this only happens for less, CEYLON_PAGER=more ceylon help works without problems.

  • it happens no matter how much you hide less:

    echo -e "#!/bin/bash\nsleep 1; bash -c 'sleep 1; less'" > pager;
    chmod +x ./pager;
    CEYLON_PAGER=./pager ceylon help

CC ceylon/ceylon-compiler#1506.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions