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

Logs -f: cannot Ctrl-C out of followed logs #99

Open
jrop opened this issue Feb 18, 2019 · 5 comments
Open

Logs -f: cannot Ctrl-C out of followed logs #99

jrop opened this issue Feb 18, 2019 · 5 comments

Comments

@jrop
Copy link

jrop commented Feb 18, 2019

Thanks for writing this! This is an amazing utility for managing/monitoring K8s!

My use-case is, when I have a pod selected, I like to follow logs at times. Now, from within click, logs works flawlessly, as expected. However, when I issue the command logs -f, it starts following the logs for the currently selected pod, but I can never terminate the followed log (by Ctrl+C, for example). The only way I have found to kill click, is Ctrl+Z, then kill %1.

I am on MacOS with Click 0.3.2

@jrop
Copy link
Author

jrop commented Feb 18, 2019

I also tried updating to using the master branch (cargo install --force: 0.4.0), and I am still seeing the same issue

@nicklan
Copy link
Collaborator

nicklan commented Feb 22, 2019

hrmm, and you're doing this via just cargo install and then running click? there was an old bug in cargo that caused cargo run to have this exact behavior, but unless you're doing cargo run with an old version of cargo that's probably not it.

If you can, could you test the ctrlc crate on your system via the following:

$ git clone https://github.com/Detegr/rust-ctrlc.git
$ cd rust-ctrlc
$ cargo run --example readme_example

Which should output something like:

$ cargo run --example readme_example
[...]
Waiting for Ctrl-C...
^CGot it! Exiting...

If that works it's probably something inside Click and I can try and look further.

@jrop
Copy link
Author

jrop commented Feb 23, 2019

@nicklan Yes, to confirm, I installed the latest version of click by cloning the repo, and running cargo install --force (as I had a previous version installed). Then I run click at my terminal whenever I run click.

I tried running rust-ctrlc directly, and this is what I got:

(master ✓) rust-ctrlc cargo run --example readme_example
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/debug/examples/readme_example`
Waiting for Ctrl-C...
^CGot it! Exiting...
(master ✓) rust-ctrlc

@nicklan
Copy link
Collaborator

nicklan commented Feb 27, 2019

odd, okay, I will try and investigate this further. thanks for the info!

@slyoldfox
Copy link

@nicklan seeing the same issue today, isn't the cause that:

                        while !env.ctrlcbool.load(Ordering::SeqCst) {
                            if let Ok(amt) = reader.read_line(&mut line) {

reader.read_line is a blocking call?

As far as I see it, the ^C displays on the screen when I press it, but will only terminate the stream after a line has been read from the server.

Shouldn't reading from the server be async or in a thread?

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

3 participants