From 7e9afaeae857a5241f237f0326ba2605f248d650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D0=B2=D0=B0=20=D0=91=D0=B0=D0=BA=D1=83=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= <122987843+sevabakutov@users.noreply.github.com> Date: Wed, 4 Dec 2024 18:15:06 +0100 Subject: [PATCH] READY: Fix module/core/process_tools/src/process.rs (#1508) * fix file * fix process file --------- Co-authored-by: Vsevolod --- module/core/process_tools/src/process.rs | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/module/core/process_tools/src/process.rs b/module/core/process_tools/src/process.rs index d11e5c3d16..d58e95455a 100644 --- a/module/core/process_tools/src/process.rs +++ b/module/core/process_tools/src/process.rs @@ -54,7 +54,7 @@ mod private // let ( program, args ) = // if cfg!( target_os = "windows" ) // { - // ( "gspread", [ "/C", exec_path ] ) + // ( "cmd", [ "/C", exec_path ] ) // } // else // { @@ -223,33 +223,33 @@ mod private run( self.form() ) } - // Executes an external process using the system shell. - // - // This function abstracts over the differences between shells on Windows and Unix-based - // systems, allowing for a unified interface to execute shell commands. - // - // # Parameters: - // - `exec_path`: The command line string to execute in the shell. - // - // # Returns: - // A `Result` containing a `Report` on success, which includes the command's output, - // or an error if the command fails to execute or complete. - // pub fn run_with_shell( self, exec_path : &str, ) -> Result< Report, Report > - // { - // let ( program, args ) = - // if cfg!( target_os = "windows" ) - // { - // ( "gspread", [ "/C", exec_path ] ) - // } - // else - // { - // ( "sh", [ "-c", exec_path ] ) - // }; - // self - // .args( args.into_iter().map( OsString::from ).collect::< Vec< _ > >() ) - // .bin_path( program ) - // .run() - // } + /// Executes an external process using the system shell. + /// + /// This function abstracts over the differences between shells on Windows and Unix-based + /// systems, allowing for a unified interface to execute shell commands. + /// + /// # Parameters: + /// - `exec_path`: The command line string to execute in the shell. + /// + /// # Returns: + /// A `Result` containing a `Report` on success, which includes the command's output, + /// or an error if the command fails to execute or complete. + pub fn run_with_shell( self, exec_path : &str, ) -> Result< Report, Report > + { + let ( program, args ) = + if cfg!( target_os = "windows" ) + { + ( "cmd", [ "/C", exec_path ] ) + } + else + { + ( "sh", [ "-c", exec_path ] ) + }; + self + .args( args.into_iter().map( OsString::from ).collect::< Vec< _ > >() ) + .bin_path( program ) + .run() + } } /// Process command output.