-
Notifications
You must be signed in to change notification settings - Fork 181
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
When I run rga-fzf
I get error Error: No such file or directory (os error 2)
#253
Comments
I’m having the same issue in a Macbook Pro M3 Pro running macOS 15.0.1 (24A348) and I think I found the source of the bug. Lines 14-32 of rga-fzf-open.rs use if fname.ends_with(".pdf") {
use std::io::ErrorKind::*;
let worked = Command::new("evince")
.arg("--find")
.arg(&query)
.arg(&fname)
.spawn()
.map_or_else(
|err| match err.kind() {
NotFound => Ok(false),
_ => Err(err),
},
|_| Ok(true),
)?;
if worked {
return Ok(());
}
}
Command::new("xdg-open").arg(fname).spawn()?;
I believe this part of the code has a few issues. First, it assumes the user has One way to fix this is to have something like this use std::env;
let (cmd, pdf_cmd) = match env::consts::OS {
“macos" => (“open" "open -a Preview.app"), //! use native Preview for macOs
"linux" => ("xdg-open", "evince"), //! use evince for linux
}
if fname.ends_with(".pdf") {
use std::io::ErrorKind::*;
let worked = Command::new(pdf_cmd)
.arg("--find")
.arg(&query)
.arg(&fname)
.spawn()
.map_or_else(
|err| match err.kind() {
NotFound => Ok(false),
_ => Err(err),
},
|_| Ok(true),
)?;
if worked {
return Ok(());
}
}
Command::new(cmd).arg(fname).spawn()?; |
I had the same problem. As a workaround I created a executable file #!/usr/bin/env bash
xdg-open $(readlink -f "${@}") In my case this worked to open a pdf file in my default viewer. As mentioned above use |
That would be a question for @phiresky.
#260 has been merged into |
@lafrenierejm |
@KKKZOZ #265 was just merged, so you can now just build from |
Thanks for the notification! 😁 |
Describe the bug
When I run
rga-fzf
it starts fzf's interactive searching and displays file content with their names.But when I press Enter to open the file it doesn't open.
Then I use ctrc+c to halt the process.
And I see that the error
Error: No such file or directory (os error 2)
happened in the console.To Reproduce
Attach example file:
Run command:
rga-fzf "break down"
Output
Error: No such file or directory (os error 2)
Screenshots
Operating System and Version
macOS 15.0 (24A335)
Output of
rga --version
ripgrep-all 0.10.6
The text was updated successfully, but these errors were encountered: