villebro commented on code in PR #2590:
URL: 
https://github.com/apache/datafusion-ballista/pull/2590#discussion_r4276089648


##########
ballista-cli/src/main.rs:
##########
@@ -125,6 +125,17 @@ pub async fn main() -> Result<(), Box<dyn 
std::error::Error>> {
 
     logging::init_logging(tui_mode.clone())?;
 
+    // Exit on SIGTERM, as the signal's default action would. That action
+    // doesn't apply to PID 1, which the CLI is in a container.
+    #[cfg(unix)]
+    tokio::spawn(async {
+        use tokio::signal::unix::{SignalKind, signal};
+        if let Ok(mut sigterm) = signal(SignalKind::terminate()) {
+            sigterm.recv().await;
+            std::process::exit(143);

Review Comment:
   Good point, thanks. fd59b27b handles the two things the exit skipped:
   
   - The REPL now writes each history entry as it's added, so the history 
survives any stop, not just SIGTERM.
   - The handler leaves the TUI's raw mode and alternate screen before exiting.
   
   A job the CLI is waiting on still keeps running on the cluster after the CLI 
stops, as it did before this PR. Cancelling it on SIGTERM would be a separate 
follow-up.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to