@@ -10,6 +10,7 @@ use tokio::{
10
10
use crate :: {
11
11
action:: Action ,
12
12
bytes:: normalize_stdout,
13
+ components:: status,
13
14
config:: { Config , RuntimeConfig } ,
14
15
exec:: exec,
15
16
store:: { Record , Store } ,
@@ -39,12 +40,11 @@ pub async fn run_executor<S: Store>(
39
40
}
40
41
41
42
let result = exec ( runtime_config. command . clone ( ) , shell. clone ( ) ) . await ;
42
- if result . is_err ( ) {
43
- eprintln ! ( "Failed to execute command" ) ;
44
- tokio :: time :: sleep ( runtime_config . interval . to_std ( ) . unwrap ( ) ) . await ;
45
- }
43
+ let ( stdout , stderr , status ) = match result {
44
+ Ok ( result ) => result ,
45
+ Err ( e ) => ( vec ! [ ] , e . to_string ( ) . bytes ( ) . collect ( ) , 1 ) ,
46
+ } ;
46
47
47
- let ( stdout, stderr, status) = result. unwrap ( ) ;
48
48
let exit_code = status;
49
49
let utf8_stdout = String :: from_utf8_lossy ( & stdout) . to_string ( ) ;
50
50
let utf8_stderr = String :: from_utf8_lossy ( & stderr) . to_string ( ) ;
@@ -113,12 +113,11 @@ pub async fn run_executor_precise<S: Store>(
113
113
}
114
114
115
115
let result = exec ( runtime_config. command . clone ( ) , shell. clone ( ) ) . await ;
116
- if result . is_err ( ) {
117
- eprintln ! ( "Failed to execute command" ) ;
118
- tokio :: time :: sleep ( runtime_config . interval . to_std ( ) . unwrap ( ) ) . await ;
119
- }
116
+ let ( stdout , stderr , status ) = match result {
117
+ Ok ( result ) => result ,
118
+ Err ( e ) => ( vec ! [ ] , e . to_string ( ) . bytes ( ) . collect ( ) , 1 ) ,
119
+ } ;
120
120
121
- let ( stdout, stderr, status) = result. unwrap ( ) ;
122
121
let exit_code = status;
123
122
let utf8_stdout = String :: from_utf8_lossy ( & stdout) . to_string ( ) ;
124
123
let utf8_stderr = String :: from_utf8_lossy ( & stderr) . to_string ( ) ;
0 commit comments