|
1 | 1 | use crate::{
|
2 |
| - core::{Error, Killable, ProcessId, ProcessInfo, ProcessInfos, Result}, |
| 2 | + core::{Error, KillableBuildable, ProcessId, ProcessInfo, ProcessInfos, Result}, |
| 3 | + unix::Killer, |
3 | 4 | Config,
|
4 | 5 | };
|
5 | 6 | use tracing::{debug, instrument};
|
@@ -148,13 +149,14 @@ pub(crate) struct KillerBuilder {}
|
148 | 149 | impl KillableBuildable for KillerBuilder {
|
149 | 150 | fn new_killable(&self, config: &Config) -> Result<Killer> {
|
150 | 151 | let killer_builder = crate::unix::KillerBuilder {};
|
151 |
| - killer_builder.new_killer(config) |
| 152 | + killer_builder.new_killable(config) |
152 | 153 | }
|
153 | 154 | }
|
154 | 155 |
|
155 | 156 | #[cfg(feature = "blocking")]
|
156 | 157 | pub(crate) mod blocking {
|
157 | 158 | use super::*;
|
| 159 | + use crate::core::blocking::ProcessInfosProvidable; |
158 | 160 |
|
159 | 161 | #[instrument]
|
160 | 162 | fn get_process_info(process_id: ProcessId, path: std::path::PathBuf) -> Result<ProcessInfo> {
|
@@ -197,11 +199,20 @@ pub(crate) mod blocking {
|
197 | 199 | }
|
198 | 200 | Ok(process_infos)
|
199 | 201 | }
|
| 202 | + |
| 203 | + pub(crate) struct ProcessInfosProvider {} |
| 204 | + |
| 205 | + impl ProcessInfosProvidable for ProcessInfosProvider { |
| 206 | + fn get_process_infos(&self) -> Result<ProcessInfos> { |
| 207 | + crate::linux::blocking::get_process_infos() |
| 208 | + } |
| 209 | + } |
200 | 210 | }
|
201 | 211 |
|
202 | 212 | #[cfg(feature = "tokio")]
|
203 | 213 | pub(crate) mod tokio {
|
204 | 214 | use super::*;
|
| 215 | + use crate::core::tokio::ProcessInfosProvidable; |
205 | 216 |
|
206 | 217 | #[instrument]
|
207 | 218 | async fn get_process_info(
|
@@ -240,4 +251,12 @@ pub(crate) mod tokio {
|
240 | 251 | }
|
241 | 252 | Ok(process_infos)
|
242 | 253 | }
|
| 254 | + |
| 255 | + pub(crate) struct ProcessInfosProvider {} |
| 256 | + |
| 257 | + impl ProcessInfosProvidable for ProcessInfosProvider { |
| 258 | + async fn get_process_infos(&self) -> Result<ProcessInfos> { |
| 259 | + crate::linux::tokio::get_process_infos().await |
| 260 | + } |
| 261 | + } |
243 | 262 | }
|
0 commit comments