Skip to content

Conversation

dandavison
Copy link
Owner

@dandavison dandavison commented Dec 26, 2020

Fixes #463 Replaces #464

Hi @marcoieni, I think this it what we were looking for. It took me a while to find, but this calls wait() on the child pager process before exiting. I was just about to merge #464 but then I read these sentences (https://doc.rust-lang.org/std/process/fn.exit.html) which seemed like the clue we were looking for.

Function std::process::exit
Note that because this function never returns, and that it terminates the process, no destructors on the current stack or any other thread's stack will be run. If a clean shutdown is needed it is recommended to only call this function at a known point where there are no more destructors left to run.

@dandavison
Copy link
Owner Author

dandavison commented Dec 26, 2020

https://github.com/dandavison/delta/blob/master/src/bat_utils/output.rs#L154-L160

impl Drop for OutputType {
    fn drop(&mut self) {
        if let OutputType::Pager(ref mut command) = *self {
            let _ = command.wait();
        }
    }
}

@dandavison dandavison merged commit c5f82fe into master Dec 26, 2020
@dandavison dandavison deleted the 463-fix-diff branch December 26, 2020 23:59
@dandavison dandavison mentioned this pull request Dec 27, 2020
@marcoieni
Copy link
Contributor

Oh, so drop wasn't called. Nice, today I learned something, thanks!

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

Successfully merging this pull request may close these issues.

🐛 delta 0.4.5 binary release messes up terminal on Ubuntu 20 04

2 participants