tshauck commented on code in PR #8856:
URL: https://github.com/apache/arrow-datafusion/pull/8856#discussion_r1452738824


##########
datafusion-cli/src/main.rs:
##########
@@ -138,7 +139,7 @@ struct Args {
 }
 
 #[tokio::main]
-pub async fn main() -> Result<()> {
+pub async fn main() -> Result<(), DataFusionCLIError> {

Review Comment:
   I ended up going a slightly different route and wrapped main as suggested 
but am having it return `ExitCode` vs `()`.
   
   From the `std::process::exit` docs, it seems like while it can work, it's 
preferable to either return `Result` (initial impl if verbose) or `ExitCode` 
(i.e. something that implements `Termination`) to better handle cleanup.
   
   > Note that because this function never returns, and that it terminates the 
process, no destructors on the current stack or any other thread’s stack will 
be run. If a clean shutdown is needed it is recommended to only call this 
function at a known point where there are no more destructors left to run; or, 
preferably, simply return a type implementing 
[Termination](https://doc.rust-lang.org/std/process/trait.Termination.html) 
(such as [ExitCode](https://doc.rust-lang.org/std/process/struct.ExitCode.html) 
or Result) from the main function and avoid this function altogether:
   
   https://doc.rust-lang.org/std/process/fn.exit.html
   
   Happy to go w/ exit if you still think it's the best route.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to