Skip to content

Commit

Permalink
Support more libruby filename formats on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
acj committed Jul 1, 2022
1 parent 562657a commit 0d52f3b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/process/ruby_process_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl ProcessType for RubyProcessType {

fn library_regex() -> Regex {
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
return Regex::new(r"/libruby\.so(\.\d+\.\d+(\.\d+)?)?").unwrap();
return Regex::new(r"/libruby(-\d+\.\d+)?\.so(\.\d+\.\d+(\.\d+)?)?").unwrap();

#[cfg(target_os = "macos")]
return Regex::new(r"/libruby\.?\d\.\d\d?\.(dylib|so)$").unwrap();
Expand Down Expand Up @@ -79,6 +79,9 @@ mod tests {
assert!(is_lib::<RubyProcessType>(&PathBuf::from(
"/usr/lib/libruby.so.2.6"
)));
assert!(is_lib::<RubyProcessType>(&PathBuf::from(
"/usr/lib/x86_64-linux-gnu/libruby-2.7.so.2.7.6"
)));

// don't blindly match libraries with ruby in the name
assert!(!is_lib::<RubyProcessType>(&PathBuf::from(
Expand Down

0 comments on commit 0d52f3b

Please sign in to comment.