From 8f6e1b57298ea5cb53074f4988fb953ae8064085 Mon Sep 17 00:00:00 2001 From: Youtirsin Date: Sat, 2 Sep 2023 19:23:09 +0800 Subject: [PATCH] [wasm] fix SIGTERM handling Signed-off-by: Youtirsin --- wasm/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wasm/src/main.rs b/wasm/src/main.rs index 1a2ecb4a..c12ac6e8 100644 --- a/wasm/src/main.rs +++ b/wasm/src/main.rs @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +use std::process::exit; + use containerd_shim::asynchronous::monitor::monitor_notify_by_pid; use futures::StreamExt; use log::{debug, error, warn}; @@ -57,7 +59,11 @@ async fn handle_signals(signals: Signals) { let mut signals = signals.fuse(); while let Some(sig) = signals.next().await { match sig { - libc::SIGTERM | libc::SIGINT => { + libc::SIGTERM => { + debug!("received {}", sig); + exit(sig); + } + libc::SIGINT => { debug!("received {}", sig); } libc::SIGCHLD => loop {