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

Paging during the command execution #36

Open
astrozot opened this issue Jun 28, 2024 · 4 comments
Open

Paging during the command execution #36

astrozot opened this issue Jun 28, 2024 · 4 comments

Comments

@astrozot
Copy link

I am not sure this is possible, but it would be extremely useful to have TerminalPager work during the execution of a slow command. That would allow one, for example, to monitor the execution of slow scripts on remote servers.

@ronisbr
Copy link
Owner

ronisbr commented Jun 28, 2024

Hi @astrozot !

This feature would be awesome, indeed! I think we can do this by using tasks and stdout redirection. Do you have an example of such slow process by any change so I can use it to test?

@astrozot
Copy link
Author

astrozot commented Jun 30, 2024

Hi @ronisbr ,

thank you for your quick reply! Sure, here is a very simple function for your tests:

function f(n)
    for i in 1:n
        println(i)
        sleep(1)
    end
    println("done")
end

Ideally, one would like to see the output of @stdout_to_pager f(5) immediately, rather than after 5 seconds.

Thank you again and let me know if I can help any further.

@ronisbr
Copy link
Owner

ronisbr commented Jul 1, 2024

The problem with that code is that it yields during println and sleep. For some other workload that does not yield, the task with TerminalPager will be locked. I will investigate if there is some workaround.

@astrozot
Copy link
Author

Hi @ronisbr , sorry for the slow reaction, I missed your comment. I understand your point, but the current version of the TerminalPager does not show any output even if the code yields, as in my example. Still, arguably, the most interesting use cases would not have a sleep command that yield un their codes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants