chmln / handlr

A better xdg-utils
MIT License
607 stars 24 forks source link

Incorrect handling of standard output and error output with nvim #38

Closed Dioprz closed 3 years ago

Dioprz commented 3 years ago

First of all, thank you very much for your development, handlr is incredibly simple and practical to use.

Now, I wanted to report a bug I'm having after testing your patch for issue #34.

Now when I use the command

handlr open anyfile.txt

Handlr tries to open the file 'properly' with nvim (apparently in the current terminal), but immediately exits and the terminal is left with the commands done.

I noticed however that if I redirect the standard output and the error output using

handlr open anyfile.txt > handlrlog.txt 2>&1

It works perfectly, and opens nvim with the file BUT in a new terminal (which I actually like that it does).

As if it were useful, the output that remains in handlrlog.txt is:

[115 09: 16: 19.743786] [PARSE ERROR] CSI code 0x74 has 3> 2 parameters [115 09: 16: 22.358337] [PARSE ERROR] CSI code 0x74 has 3> 2 parameters

If I can help with any other information, I will be attentive. Thank you very much in advance!

chmln commented 3 years ago

Hey @Wisehh thanks for the kind words.

but immediately exits and the terminal is left with the commands done.

So the logic in the source code is like this:

if self.terminal && atty::is(atty::Stream::Stdout) {
  cmd.spawn()?.wait()?;
} else {
  cmd.stdout(Stdio::null()).stderr(Stdio::null()).spawn()?;
}

We'd have to figure out why nvim in your case exits immediately, because wait() means that handlr waits for the neovim process to exit. I use neovim as well and can't seem to reproduce this bug locally.

Which handlr version are you on?

Dioprz commented 3 years ago

Well ... I found the bug, and it had nothing to do with handlr actually, but with paru. The exact same thing happened to me as shared by qwuy1290 at #34.

Although I read the situation, as paru gave me two handlr updates I did not pay much attention, and thanks to your version question I noticed that it was in version 0.5, so I had to clear the local paru cache to compile 0.6 .2.

My mistake completely, excuse the false alarm, and thanks for the quick response. Have a nice day!