@@ -49,7 +49,9 @@ pub async fn handle_proxy(exec_name: &str, rest_args: &[String]) -> miette::Resu
4949 let package_type = PackageType :: from_str ( exec_name) ;
5050 let package = Package :: new ( package_type, String :: new ( ) , None ) . await ;
5151
52- handle_package_process ( rest_args, package) . await . unwrap ( ) ;
52+ handle_package_process ( rest_args, package)
53+ . await
54+ . map_err ( |err| miette:: miette!( "{err}" ) ) ?;
5355
5456 Ok ( ( ) )
5557}
@@ -61,11 +63,11 @@ pub async fn handle_proxy(exec_name: &str, rest_args: &[String]) -> miette::Resu
6163/// process with the given arguments. The function then enters a loop where it
6264/// continuously checks the status of the spawned process. If the process exits
6365/// with a status code of `0`, the function returns `Ok(())`. If the process
64- /// exits with a non-zero status code, the function returns an error with the
65- /// status code as the error message . If the process is terminated by a signal,
66- /// the function returns an error with the message "Process terminated by
67- /// signal". If the function fails to wait on the child process, it returns an
68- /// error with the message "Failed to wait on child process".
66+ /// exits with a non-zero status code, the current process is terminated with the
67+ /// same exit code . If the process is terminated by a signal, the function
68+ /// returns an error with the message "Process terminated by signal". If the
69+ /// function fails to wait on the child process, it returns an error with the
70+ /// message "Failed to wait on child process".
6971///
7072/// # Arguments
7173///
@@ -172,13 +174,11 @@ async fn watch_process(
172174/// operation.
173175///
174176/// * `Ok(())` - The process exited successfully.
175- /// * `Err(anyhow::Error)` - The process exited with an error code or was
176- /// terminated by a signal.
177+ /// * `Err(anyhow::Error)` - The process was terminated by a signal.
177178///
178179/// # Errors
179180///
180- /// This function will return an error if the process exited with a non-zero
181- /// exit code or was terminated by a signal.
181+ /// This function will return an error if the process was terminated by a signal.
182182///
183183/// # Examples
184184///
@@ -191,8 +191,9 @@ async fn handle_process_exit(
191191) -> Result < ( ) > {
192192 match status?. code ( ) {
193193 Some ( 0 ) => Ok ( ( ) ) ,
194- Some ( 2 ) => Ok ( ( ) ) ,
195- Some ( code) => Err ( anyhow ! ( "Process exited with error code {}" , code) ) ,
194+ Some ( code) => {
195+ std:: process:: exit ( code) ;
196+ }
196197 None => Err ( anyhow ! ( "Process terminated by signal" ) ) ,
197198 }
198199}
0 commit comments