@@ -6,14 +6,18 @@ use log::{debug, info};
6
6
use validator:: Validate ;
7
7
8
8
use crate :: cleanup:: CleanupManager ;
9
- use crate :: commands:: { run_command, spawn_command_with_pidfile, stop_using_pidfile} ;
9
+ use crate :: commands:: {
10
+ run_command, spawn_command_with_pidfile, status_using_pidfile, stop_using_pidfile,
11
+ } ;
10
12
use crate :: config:: ContainerCommand as ConfigContainerCommand ;
11
13
use crate :: context:: Context ;
12
14
use crate :: default:: { default_optional, default_to} ;
13
15
use crate :: outputs:: OutputsManager ;
14
16
use crate :: rand:: rand_string;
15
17
use crate :: shell:: { escape_and_prepend, escape_and_prepend_vec, escape_string} ;
16
- use crate :: target:: { create_metadata_dir, CommandInfo , Runnable , Startable , TargetInfo } ;
18
+ use crate :: target:: {
19
+ create_metadata_dir, CommandInfo , Runnable , Startable , StatusResult , TargetInfo ,
20
+ } ;
17
21
18
22
#[ derive( Debug , Clone , Validate ) ]
19
23
pub struct ContainerCommand {
@@ -189,6 +193,18 @@ impl Startable for ContainerCommand {
189
193
} ;
190
194
stop_using_pidfile ( & pid_path, log_stop)
191
195
}
196
+
197
+ fn status ( & self , _context : & Context , _outputs : & mut OutputsManager ) -> Result < StatusResult > {
198
+ let config_dir = create_metadata_dir ( self . target_info . name . to_string ( ) . as_str ( ) ) ?;
199
+
200
+ let pid_path = config_dir. join ( "pid" ) ;
201
+ debug ! (
202
+ "Searching for pid file for target <{}> at <{}>" ,
203
+ self . target_info. name,
204
+ pid_path. display( )
205
+ ) ;
206
+ status_using_pidfile ( & pid_path) . map ( |s| s. into ( ) )
207
+ }
192
208
}
193
209
194
210
pub struct ContainerRunInfo {
0 commit comments