Skip to content
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

otp 26 messes up the tty #8487

Open
mbj4668 opened this issue May 16, 2024 · 0 comments
Open

otp 26 messes up the tty #8487

mbj4668 opened this issue May 16, 2024 · 0 comments
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@mbj4668
Copy link

mbj4668 commented May 16, 2024

Describe the bug
Run an escript that prodcues (slow) output, pipe it to less, and hit q to quit less. The tty is now in a bad state (e.g., with bash, prev history doesn't work). reset or stty sane is needed to fix it.

To Reproduce
Save the script below as test, make it executable and run test <name of a large text file> | less in bash. Hit q. Wait. When you get the bash prompt, try ctrl-p etc.

#!/usr/bin/env escript
%% -*- erlang -*-

main([FName]) ->
    {ok, Fd} = file:open(FName, [read]),
    loop(Fd),
    file:close(Fd).

loop(Fd) ->
    case file:read(Fd, 1024) of
        {ok, Data} ->
            io:put_chars(Data),
            timer:sleep(500),
            loop(Fd);
        _ ->
            done
    end.

Expected behavior
The tty should not be messed up. Also, it takes several seconds more than in 25 to get the prompt back.

Affected versions
I have tried 26.1.2 and 26.2.5.

@mbj4668 mbj4668 added the bug Issue is reported as a bug label May 16, 2024
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

4 participants