MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / kill

Method kill

crates/openshell-supervisor-process/src/process.rs:757–781  ·  view source on GitHub ↗

Kill the process. # Errors Returns an error if the process cannot be killed.

(&mut self)

Source from the content-addressed store, hash-verified

755 ///
756 /// Returns an error if the process cannot be killed.
757 pub fn kill(&mut self) -> Result<()> {
758 // First try SIGTERM
759 if let Err(e) = self.signal(Signal::SIGTERM) {
760 openshell_ocsf::ocsf_emit!(
761 openshell_ocsf::ProcessActivityBuilder::new(openshell_ocsf::ctx::ctx())
762 .activity(openshell_ocsf::ActivityId::Close)
763 .severity(openshell_ocsf::SeverityId::Medium)
764 .status(openshell_ocsf::StatusId::Failure)
765 .message(format!("Failed to send SIGTERM: {e}"))
766 .build()
767 );
768 }
769
770 // Give the process a moment to terminate gracefully
771 std::thread::sleep(std::time::Duration::from_millis(100));
772
773 // Force kill if still running
774 if let Some(id) = self.child.id() {
775 debug!(pid = id, "Sending SIGKILL");
776 let pid = i32::try_from(id).unwrap_or(i32::MAX);
777 let _ = signal::kill(Pid::from_raw(pid), Signal::SIGKILL);
778 }
779
780 Ok(())
781 }
782}
783
784impl Drop for ProcessHandle {

Callers 15

start_port_forwardsFunction · 0.80
sandbox_forwardFunction · 0.80
run_processFunction · 0.80
spawnFunction · 0.80
terminate_vm_processFunction · 0.80
dropMethod · 0.80
cleanup_gvproxyFunction · 0.80
create_keepMethod · 0.80

Calls 2

signalMethod · 0.80
idMethod · 0.45