@@ -745,22 +745,25 @@ async fn run_process_async(executable: &str, args: Option<Vec<String>>, input: O
745
745
/// Will panic if tokio runtime can't be created.
746
746
///
747
747
#[ allow( clippy:: implicit_hasher) ]
748
- #[ tokio:: main]
749
- pub async fn invoke_command ( executable : & str , args : Option < Vec < String > > , input : Option < & str > , cwd : Option < & str > , env : Option < HashMap < String , String > > , exit_codes : Option < & HashMap < i32 , String > > ) -> Result < ( i32 , String , String ) , DscError > {
750
- trace ! ( "{}" , t!( "dscresources.commandResource.commandInvoke" , executable = executable, args = args : { : ?} ) ) ;
751
- if let Some ( cwd) = cwd {
752
- trace ! ( "{}" , t!( "dscresources.commandResource.commandCwd" , cwd = cwd) ) ;
753
- }
748
+ pub fn invoke_command ( executable : & str , args : Option < Vec < String > > , input : Option < & str > , cwd : Option < & str > , env : Option < HashMap < String , String > > , exit_codes : Option < & HashMap < i32 , String > > ) -> Result < ( i32 , String , String ) , DscError > {
749
+ tokio:: runtime:: Builder :: new_multi_thread ( ) . enable_all ( ) . build ( ) . unwrap ( ) . block_on (
750
+ async {
751
+ trace ! ( "{}" , t!( "dscresources.commandResource.commandInvoke" , executable = executable, args = args : { : ?} ) ) ;
752
+ if let Some ( cwd) = cwd {
753
+ trace ! ( "{}" , t!( "dscresources.commandResource.commandCwd" , cwd = cwd) ) ;
754
+ }
754
755
755
- match run_process_async ( executable, args, input, cwd, env, exit_codes) . await {
756
- Ok ( ( code, stdout, stderr) ) => {
757
- Ok ( ( code, stdout, stderr) )
758
- } ,
759
- Err ( err) => {
760
- error ! ( "{}" , t!( "dscresources.commandResource.runProcessError" , executable = executable, error = err) ) ;
761
- Err ( err)
756
+ match run_process_async ( executable, args, input, cwd, env, exit_codes) . await {
757
+ Ok ( ( code, stdout, stderr) ) => {
758
+ Ok ( ( code, stdout, stderr) )
759
+ } ,
760
+ Err ( err) => {
761
+ error ! ( "{}" , t!( "dscresources.commandResource.runProcessError" , executable = executable, error = err) ) ;
762
+ Err ( err)
763
+ }
764
+ }
762
765
}
763
- }
766
+ )
764
767
}
765
768
766
769
/// Process the arguments for a command resource.
0 commit comments