cli: Add support for --stop-signal (#1462)

- Closes #1581.
- This adds stop signal support to the cli. The priority is:
  1. If an explicit stop signal is passed on the cli use this.
  2. If not, check if there is a stop signal in the image config.
  3. Finally, use the default (TERM).
This commit is contained in:
Danny Canter
2026-05-21 17:55:48 -07:00
committed by GitHub
parent 3d291ff865
commit de780c1478
9 changed files with 103 additions and 19 deletions
@@ -19,7 +19,6 @@ import ContainerAPIClient
import ContainerResource
import Containerization
import ContainerizationError
import ContainerizationOS
import Foundation
import Logging
@@ -35,7 +34,7 @@ extension Application {
var all = false
@Option(name: .shortAndLong, help: "Signal to send to the containers")
var signal: String = "SIGTERM"
var signal: String?
@Option(name: .shortAndLong, help: "Seconds to wait before killing the containers")
var time: Int32 = 5
@@ -68,7 +67,7 @@ extension Application {
let opts = ContainerStopOptions(
timeoutInSeconds: self.time,
signal: try Signal(self.signal).rawValue
signal: self.signal
)
try await Self.stopContainers(
client: client,