@@ -20,17 +20,20 @@ fn register() {
20
20
#[ derive( Clone ) ]
21
21
pub ( crate ) struct Command {
22
22
opts : options:: Options ,
23
+ binary : String ,
23
24
}
24
25
25
26
impl Command {
26
27
pub fn new ( ) -> Self {
27
28
Command {
28
29
opts : options:: Options :: default ( ) ,
30
+ binary : String :: default ( ) ,
29
31
}
30
32
}
31
33
32
34
async fn run ( & self , creds : & Credentials ) -> Result < std:: process:: Output , Error > {
33
35
let ( target, port) = utils:: parse_target ( & creds. target , 0 ) ?;
36
+
34
37
let args = shell_words:: split (
35
38
& self
36
39
. opts
@@ -42,13 +45,13 @@ impl Command {
42
45
)
43
46
. unwrap ( ) ;
44
47
45
- log:: debug!( "{} {}" , & self . opts . cmd_binary , args. join( " " ) ) ;
48
+ log:: debug!( "{} {}" , & self . binary , args. join( " " ) ) ;
46
49
47
- let child = std:: process:: Command :: new ( & self . opts . cmd_binary )
50
+ let child = std:: process:: Command :: new ( & self . binary )
48
51
. args ( & args)
49
52
. stdin ( Stdio :: null ( ) )
50
- . stdout ( Stdio :: null ( ) )
51
- . stderr ( Stdio :: null ( ) )
53
+ . stdout ( Stdio :: piped ( ) )
54
+ . stderr ( Stdio :: piped ( ) )
52
55
. spawn ( )
53
56
. map_err ( |e| e. to_string ( ) ) ?;
54
57
@@ -63,12 +66,9 @@ impl Plugin for Command {
63
66
}
64
67
65
68
fn setup ( & mut self , opts : & Options ) -> Result < ( ) , Error > {
69
+ self . binary = opts. target . clone ( ) . unwrap ( ) ;
66
70
self . opts = opts. cmd . clone ( ) ;
67
- if self . opts . cmd_binary . is_empty ( ) {
68
- Err ( "please provide --cmd-binary and optionally --cmd-args" . to_owned ( ) )
69
- } else {
70
- Ok ( ( ) )
71
- }
71
+ Ok ( ( ) )
72
72
}
73
73
74
74
async fn attempt ( & self , creds : & Credentials , timeout : Duration ) -> Result < Option < Loot > , Error > {
0 commit comments