Skip to content

Commit

Permalink
READY: Fix module/core/process_tools/src/process.rs (#1508)
Browse files Browse the repository at this point in the history
* fix file

* fix process file

---------

Co-authored-by: Vsevolod <sevabakutov322@gmail.com>
  • Loading branch information
sevabakutov and Vsevolod authored Dec 4, 2024
1 parent 2d5382e commit 7e9afae
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions module/core/process_tools/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod private
// let ( program, args ) =
// if cfg!( target_os = "windows" )
// {
// ( "gspread", [ "/C", exec_path ] )
// ( "cmd", [ "/C", exec_path ] )
// }
// else
// {
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 7e9afae

Please sign in to comment.